feature(doc_cfg): set cfg(rustdoc) when rustdoc is running
This commit is contained in:
parent
ec4a752202
commit
1a3bb2795b
4 changed files with 30 additions and 2 deletions
|
@ -466,7 +466,8 @@ fn main_args(args: &[String]) -> isize {
|
|||
|
||||
let output = matches.opt_str("o").map(|s| PathBuf::from(&s));
|
||||
let css_file_extension = matches.opt_str("e").map(|s| PathBuf::from(&s));
|
||||
let cfgs = matches.opt_strs("cfg");
|
||||
let mut cfgs = matches.opt_strs("cfg");
|
||||
cfgs.push("rustdoc".to_string());
|
||||
|
||||
if let Some(ref p) = css_file_extension {
|
||||
if !p.is_file() {
|
||||
|
@ -643,7 +644,8 @@ where R: 'static + Send,
|
|||
for s in &matches.opt_strs("L") {
|
||||
paths.add_path(s, ErrorOutputType::default());
|
||||
}
|
||||
let cfgs = matches.opt_strs("cfg");
|
||||
let mut cfgs = matches.opt_strs("cfg");
|
||||
cfgs.push("rustdoc".to_string());
|
||||
let triple = matches.opt_str("target").map(|target| {
|
||||
if target.ends_with(".json") {
|
||||
TargetTriple::TargetPath(PathBuf::from(target))
|
||||
|
|
|
@ -1148,6 +1148,7 @@ const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[
|
|||
("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)),
|
||||
("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)),
|
||||
("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)),
|
||||
("rustdoc", "doc_cfg", cfg_fn!(doc_cfg)),
|
||||
];
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
14
src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs
Normal file
14
src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change
|
||||
pub struct SomeStruct;
|
||||
|
||||
fn main() {}
|
11
src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr
Normal file
11
src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr
Normal file
|
@ -0,0 +1,11 @@
|
|||
error[E0658]: `cfg(rustdoc)` is experimental and subject to change (see issue #43781)
|
||||
--> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:11:7
|
||||
|
|
||||
LL | #[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: add #![feature(doc_cfg)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
Loading…
Add table
Add a link
Reference in a new issue