Skip to content

Commit 1d89492

Browse files
authored
Rollup merge of rust-lang#66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavus
rename cfg(rustdoc) into cfg(doc) Needed by rust-lang#61351 r? @QuietMisdreavus
2 parents 7c666a7 + 0282c27 commit 1d89492

File tree

13 files changed

+36
-36
lines changed

13 files changed

+36
-36
lines changed

src/bootstrap/bin/rustdoc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() {
2525
let mut dylib_path = bootstrap::util::dylib_path();
2626
dylib_path.insert(0, PathBuf::from(libdir.clone()));
2727

28-
//FIXME(misdreavus): once stdsimd uses cfg(rustdoc) instead of cfg(dox), remove the `--cfg dox`
28+
//FIXME(misdreavus): once stdsimd uses cfg(doc) instead of cfg(dox), remove the `--cfg dox`
2929
//arguments here
3030
let mut cmd = Command::new(rustdoc);
3131
cmd.args(&args)

src/doc/rustdoc/src/unstable-features.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,24 @@ item, it will be accompanied by a banner explaining that the item is only availa
106106
platforms.
107107

108108
For Rustdoc to document an item, it needs to see it, regardless of what platform it's currently
109-
running on. To aid this, Rustdoc sets the flag `#[cfg(rustdoc)]` when running on your crate.
109+
running on. To aid this, Rustdoc sets the flag `#[cfg(doc)]` when running on your crate.
110110
Combining this with the target platform of a given item allows it to appear when building your crate
111111
normally on that platform, as well as when building documentation anywhere.
112112

113-
For example, `#[cfg(any(windows, rustdoc))]` will preserve the item either on Windows or during the
113+
For example, `#[cfg(any(windows, doc))]` will preserve the item either on Windows or during the
114114
documentation process. Then, adding a new attribute `#[doc(cfg(windows))]` will tell Rustdoc that
115115
the item is supposed to be used on Windows. For example:
116116

117117
```rust
118118
#![feature(doc_cfg)]
119119

120120
/// Token struct that can only be used on Windows.
121-
#[cfg(any(windows, rustdoc))]
121+
#[cfg(any(windows, doc))]
122122
#[doc(cfg(windows))]
123123
pub struct WindowsToken;
124124

125125
/// Token struct that can only be used on Unix.
126-
#[cfg(any(unix, rustdoc))]
126+
#[cfg(any(unix, doc))]
127127
#[doc(cfg(unix))]
128128
pub struct UnixToken;
129129
```

src/doc/unstable-book/src/language-features/doc-cfg.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This attribute has two effects:
1313
2. The item's doc-tests will only run on the specific platform.
1414

1515
In addition to allowing the use of the `#[doc(cfg)]` attribute, this feature enables the use of a
16-
special conditional compilation flag, `#[cfg(rustdoc)]`, set whenever building documentation on your
16+
special conditional compilation flag, `#[cfg(doc)]`, set whenever building documentation on your
1717
crate.
1818

1919
This feature was introduced as part of PR [#43348] to allow the platform-specific parts of the
@@ -22,7 +22,7 @@ standard library be documented.
2222
```rust
2323
#![feature(doc_cfg)]
2424

25-
#[cfg(any(windows, rustdoc))]
25+
#[cfg(any(windows, doc))]
2626
#[doc(cfg(windows))]
2727
/// The application's icon in the notification area (a.k.a. system tray).
2828
///

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
247247
} = options;
248248

249249
// Add the rustdoc cfg into the doc build.
250-
cfgs.push("rustdoc".to_string());
250+
cfgs.push("doc".to_string());
251251

252252
let cpath = Some(input.clone());
253253
let input = Input::File(input);

src/librustdoc/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn run(options: Options) -> i32 {
6464
};
6565

6666
let mut cfgs = options.cfgs.clone();
67-
cfgs.push("rustdoc".to_owned());
67+
cfgs.push("doc".to_owned());
6868
cfgs.push("doctest".to_owned());
6969
let config = interface::Config {
7070
opts: sessopts,

src/libstd/os/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![allow(missing_docs, nonstandard_style, missing_debug_implementations)]
55

66
cfg_if::cfg_if! {
7-
if #[cfg(rustdoc)] {
7+
if #[cfg(doc)] {
88

99
// When documenting libstd we want to show unix/windows/linux modules as
1010
// these are the "main modules" that are used across platforms. This

src/libstd/sys/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ cfg_if::cfg_if! {
5656
// then later used in the `std::os` module when documenting, for example,
5757
// Windows when we're compiling for Linux.
5858

59-
#[cfg(rustdoc)]
59+
#[cfg(doc)]
6060
cfg_if::cfg_if! {
6161
if #[cfg(unix)] {
6262
// On unix we'll document what's already available
@@ -80,7 +80,7 @@ cfg_if::cfg_if! {
8080
}
8181
}
8282

83-
#[cfg(rustdoc)]
83+
#[cfg(doc)]
8484
cfg_if::cfg_if! {
8585
if #[cfg(windows)] {
8686
// On windows we'll just be documenting what's already available

src/libstd/sys/unix/mod.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
use crate::io::ErrorKind;
44

5-
#[cfg(any(rustdoc, target_os = "linux"))] pub use crate::os::linux as platform;
6-
7-
#[cfg(all(not(rustdoc), target_os = "android"))] pub use crate::os::android as platform;
8-
#[cfg(all(not(rustdoc), target_os = "dragonfly"))] pub use crate::os::dragonfly as platform;
9-
#[cfg(all(not(rustdoc), target_os = "freebsd"))] pub use crate::os::freebsd as platform;
10-
#[cfg(all(not(rustdoc), target_os = "haiku"))] pub use crate::os::haiku as platform;
11-
#[cfg(all(not(rustdoc), target_os = "ios"))] pub use crate::os::ios as platform;
12-
#[cfg(all(not(rustdoc), target_os = "macos"))] pub use crate::os::macos as platform;
13-
#[cfg(all(not(rustdoc), target_os = "netbsd"))] pub use crate::os::netbsd as platform;
14-
#[cfg(all(not(rustdoc), target_os = "openbsd"))] pub use crate::os::openbsd as platform;
15-
#[cfg(all(not(rustdoc), target_os = "solaris"))] pub use crate::os::solaris as platform;
16-
#[cfg(all(not(rustdoc), target_os = "emscripten"))] pub use crate::os::emscripten as platform;
17-
#[cfg(all(not(rustdoc), target_os = "fuchsia"))] pub use crate::os::fuchsia as platform;
18-
#[cfg(all(not(rustdoc), target_os = "l4re"))] pub use crate::os::linux as platform;
19-
#[cfg(all(not(rustdoc), target_os = "redox"))] pub use crate::os::redox as platform;
5+
#[cfg(any(doc, target_os = "linux"))] pub use crate::os::linux as platform;
6+
7+
#[cfg(all(not(doc), target_os = "android"))] pub use crate::os::android as platform;
8+
#[cfg(all(not(doc), target_os = "dragonfly"))] pub use crate::os::dragonfly as platform;
9+
#[cfg(all(not(doc), target_os = "freebsd"))] pub use crate::os::freebsd as platform;
10+
#[cfg(all(not(doc), target_os = "haiku"))] pub use crate::os::haiku as platform;
11+
#[cfg(all(not(doc), target_os = "ios"))] pub use crate::os::ios as platform;
12+
#[cfg(all(not(doc), target_os = "macos"))] pub use crate::os::macos as platform;
13+
#[cfg(all(not(doc), target_os = "netbsd"))] pub use crate::os::netbsd as platform;
14+
#[cfg(all(not(doc), target_os = "openbsd"))] pub use crate::os::openbsd as platform;
15+
#[cfg(all(not(doc), target_os = "solaris"))] pub use crate::os::solaris as platform;
16+
#[cfg(all(not(doc), target_os = "emscripten"))] pub use crate::os::emscripten as platform;
17+
#[cfg(all(not(doc), target_os = "fuchsia"))] pub use crate::os::fuchsia as platform;
18+
#[cfg(all(not(doc), target_os = "l4re"))] pub use crate::os::linux as platform;
19+
#[cfg(all(not(doc), target_os = "redox"))] pub use crate::os::redox as platform;
2020

2121
pub use self::rand::hashmap_random_keys;
2222
pub use libc::strlen;

src/libstd/sys_common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub mod backtrace;
4545
pub mod condvar;
4646
pub mod io;
4747
pub mod mutex;
48-
#[cfg(any(rustdoc, // see `mod os`, docs are generated for multiple platforms
48+
#[cfg(any(doc, // see `mod os`, docs are generated for multiple platforms
4949
unix,
5050
target_os = "redox",
5151
target_os = "cloudabi",

src/libsyntax/feature_gate/builtin_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const GATED_CFGS: &[(Symbol, Symbol, GateFn)] = &[
3030
(sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)),
3131
(sym::target_has_atomic, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)),
3232
(sym::target_has_atomic_load_store, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)),
33-
(sym::rustdoc, sym::doc_cfg, cfg_fn!(doc_cfg)),
33+
(sym::doc, sym::doc_cfg, cfg_fn!(doc_cfg)),
3434
];
3535

3636
#[derive(Debug)]

src/test/rustdoc-ui/doc-test-rustdoc-feature.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#![feature(doc_cfg)]
66

7-
// Make sure `cfg(rustdoc)` is set when finding doctests but not inside the doctests.
7+
// Make sure `cfg(doc)` is set when finding doctests but not inside the doctests.
88

99
/// ```
1010
/// #![feature(doc_cfg)]
11-
/// assert!(!cfg!(rustdoc));
11+
/// assert!(!cfg!(doc));
1212
/// ```
13-
#[cfg(rustdoc)]
13+
#[cfg(doc)]
1414
pub struct Foo;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change
1+
#[cfg(doc)] //~ ERROR: `cfg(doc)` is experimental and subject to change
22
pub struct SomeStruct;
33

44
fn main() {}

src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0658]: `cfg(rustdoc)` is experimental and subject to change
1+
error[E0658]: `cfg(doc)` is experimental and subject to change
22
--> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:1:7
33
|
4-
LL | #[cfg(rustdoc)]
5-
| ^^^^^^^
4+
LL | #[cfg(doc)]
5+
| ^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/43781
88
= help: add `#![feature(doc_cfg)]` to the crate attributes to enable

0 commit comments

Comments
 (0)