Skip to content

Commit a056bf9

Browse files
Rename the cfg attribute from rustdoc to doc
1 parent 086c8d3 commit a056bf9

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/doc/rustdoc/src/the-doc-attribute.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Since primitive types are defined in the compiler, there's no place to attach do
215215
attributes. This attribute is used by the standard library to provide a way to generate
216216
documentation for primitive types.
217217

218-
## `#[cfg(rustdoc)]`: Documenting platform-/feature-specific information
218+
## `#[cfg(doc)]`: Documenting platform-/feature-specific information
219219

220220
For conditional compilation, Rustdoc treats your crate the same way the compiler does: Only things
221221
from the host target are available (or from the given `--target` if present), and everything else is
@@ -224,9 +224,9 @@ on different targets and you want your documentation to reflect all the availabl
224224
provide.
225225

226226
If you want to make sure an item is seen by Rustdoc regardless of what platform it's targeting,
227-
you can apply `#[cfg(rustdoc)]` to it. Rustdoc sets this whenever it's building documentation, so
227+
you can apply `#[cfg(doc)]` to it. Rustdoc sets this whenever it's building documentation, so
228228
anything that uses that flag will make it into documentation it generates. To apply this to an item
229-
with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, rustdoc))]`.
229+
with other `#[cfg]` filters on it, you can write something like `#[cfg(any(windows, doc))]`.
230230
This will preserve the item either when built normally on Windows, or when being documented
231231
anywhere.
232232

@@ -236,10 +236,10 @@ Example:
236236

237237
```rust
238238
/// Token struct that can only be used on Windows.
239-
#[cfg(any(windows, rustdoc))]
239+
#[cfg(any(windows, doc))]
240240
pub struct WindowsToken;
241241
/// Token struct that can only be used on Unix.
242-
#[cfg(any(unix, rustdoc))]
242+
#[cfg(any(unix, doc))]
243243
pub struct UnixToken;
244244
```
245245

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
250250

251251
let extern_names: Vec<String> = externs.iter().map(|(s,_)| s).cloned().collect();
252252

253-
// Add the rustdoc cfg into the doc build.
253+
// Add the doc cfg into the doc build.
254254
cfgs.push("doc".to_string());
255255

256256
let cpath = Some(input.clone());

src/libsyntax_pos/symbol.rs

-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,6 @@ symbols! {
624624
rustc_test_marker,
625625
rustc_then_this_would_need,
626626
rustc_variance,
627-
rustdoc,
628627
rustfmt,
629628
rust_eh_personality,
630629
rust_eh_unwind_resume,

src/test/ui/cfg-rustdoc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(rustdoc)]
1+
#[cfg(doc)]
22
pub struct Foo;
33

44
fn main() {

0 commit comments

Comments
 (0)