fe807fcf3e
rustdoc: set cfg(doctest) when collecting doctests Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR. As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.) Tracking issue: https://github.com/rust-lang/rust/issues/62210 |
||
---|---|---|
.. | ||
attr | ||
diagnostics | ||
ext | ||
parse | ||
util | ||
ast.rs | ||
build.rs | ||
Cargo.toml | ||
config.rs | ||
early_buffered_lints.rs | ||
entry.rs | ||
error_codes.rs | ||
feature_gate.rs | ||
json.rs | ||
lib.rs | ||
mut_visit.rs | ||
ptr.rs | ||
README.md | ||
show_span.rs | ||
source_map.rs | ||
std_inject.rs | ||
test_snippet.rs | ||
test.rs | ||
tokenstream.rs | ||
visit.rs |
The syntax
crate contains those things concerned purely with syntax
– that is, the AST ("abstract syntax tree"), parser, pretty-printer,
lexer, macro expander, and utilities for traversing ASTs.
For more information about how these things work in rustc, see the rustc guide: