diff --git a/compiler/rustc_attr_data_structures/src/version.rs b/compiler/rustc_attr_data_structures/src/version.rs index 69b0e041d819d..c9d0ac3760328 100644 --- a/compiler/rustc_attr_data_structures/src/version.rs +++ b/compiler/rustc_attr_data_structures/src/version.rs @@ -1,4 +1,5 @@ use std::fmt::{self, Display}; +use std::sync::OnceLock; use rustc_macros::{ Decodable, Encodable, HashStable_Generic, PrintAttribute, current_rustc_version, @@ -16,8 +17,29 @@ pub struct RustcVersion { impl RustcVersion { pub const CURRENT: Self = current_rustc_version!(); + pub fn current_configurable() -> Self { + *CURRENT_CONFIGURABLE.get_or_init(|| { + if let Ok(override_var) = std::env::var("RUSTC_OVERRIDE_VERSION_STRING") + && let Some(override_) = Self::parse_str(&override_var) + { + override_ + } else { + Self::CURRENT + } + }) + } + fn parse_str(value: &str) -> Option { + // Ignore any suffixes such as "-dev" or "-nightly". + let mut components = value.split('-').next().unwrap().splitn(3, '.'); + let major = components.next()?.parse().ok()?; + let minor = components.next()?.parse().ok()?; + let patch = components.next().unwrap_or("0").parse().ok()?; + Some(RustcVersion { major, minor, patch }) + } } +static CURRENT_CONFIGURABLE: OnceLock = OnceLock::new(); + impl Display for RustcVersion { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch) diff --git a/compiler/rustc_attr_parsing/src/attributes/cfg.rs b/compiler/rustc_attr_parsing/src/attributes/cfg.rs index 7cb1fede1741a..943b8527d5348 100644 --- a/compiler/rustc_attr_parsing/src/attributes/cfg.rs +++ b/compiler/rustc_attr_parsing/src/attributes/cfg.rs @@ -129,9 +129,9 @@ pub fn eval_condition( // See https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454 for details if sess.psess.assume_incomplete_release { - RustcVersion::CURRENT > min_version + RustcVersion::current_configurable() > min_version } else { - RustcVersion::CURRENT >= min_version + RustcVersion::current_configurable() >= min_version } } MetaItemKind::List(mis) => { diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 820af9ac84b2c..e8eac11c74878 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -109,6 +109,8 @@ declare_features! ( (accepted, cfg_target_feature, "1.27.0", Some(29717)), /// Allows `cfg(target_vendor = "...")`. (accepted, cfg_target_vendor, "1.33.0", Some(29718)), + /// Allow conditional compilation depending on rust version + (accepted, cfg_version, "CURRENT_RUSTC_VERSION", Some(64796)), /// Allows implementing `Clone` for closures where possible (RFC 2132). (accepted, clone_closures, "1.26.0", Some(44490)), /// Allows coercing non capturing closures to function pointers. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index c117e0fcf7ccc..bf216d3b16e74 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -33,7 +33,6 @@ const GATED_CFGS: &[GatedCfg] = &[ Features::cfg_target_has_atomic, ), (sym::sanitize, sym::cfg_sanitize, Features::cfg_sanitize), - (sym::version, sym::cfg_version, Features::cfg_version), (sym::relocation_model, sym::cfg_relocation_model, Features::cfg_relocation_model), (sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi), (sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi), diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 6cdcf451f37e3..d8a0824d756f2 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -417,8 +417,6 @@ declare_features! ( (unstable, cfg_target_thread_local, "1.7.0", Some(29594)), /// Allows the use of `#[cfg(ub_checks)` to check if UB checks are enabled. (unstable, cfg_ub_checks, "1.79.0", Some(123499)), - /// Allow conditional compilation depending on rust version - (unstable, cfg_version, "1.45.0", Some(64796)), /// Allows to use the `#[cfi_encoding = ""]` attribute. (unstable, cfi_encoding, "1.71.0", Some(89653)), /// Allows `for<...>` on closures and coroutines. diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 08180bf8f8b2c..fbca2e515a136 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -810,9 +810,10 @@ lint_undropped_manually_drops = calls to `std::mem::drop` with `std::mem::Manual .suggestion = use `std::mem::ManuallyDrop::into_inner` to get the inner value lint_unexpected_builtin_cfg = unexpected `--cfg {$cfg}` flag - .controlled_by = config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}` .incoherent = manually setting a built-in cfg can and does create incoherent behaviors +lint_unexpected_builtin_cfg_controlled_by = config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}` + lint_unexpected_cfg_add_build_rs_println = or consider adding `{$build_rs_println}` to the top of the `build.rs` lint_unexpected_cfg_add_cargo_feature = consider using a Cargo feature instead lint_unexpected_cfg_add_cargo_toml_lint_cfg = or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:{$cargo_toml_lint_cfg} diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 40ca9e05d95d6..5db50474a9a9f 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -448,7 +448,13 @@ pub(super) fn decorate_lint( lints::OutOfScopeMacroCalls { span, path, location }.decorate_lint(diag) } BuiltinLintDiag::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by } => { - lints::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by }.decorate_lint(diag) + lints::UnexpectedBuiltinCfg { + cfg, + cfg_name, + controlled_by: controlled_by + .map(|controlled_by| lints::ControlledBy { controlled_by }), + } + .decorate_lint(diag) } BuiltinLintDiag::ElidedNamedLifetimes { elided: (span, kind), resolution } => { match resolution { diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 7268a7f704fcb..479d582f7ae7a 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -2498,11 +2498,17 @@ pub(crate) mod unexpected_cfg_value { #[derive(LintDiagnostic)] #[diag(lint_unexpected_builtin_cfg)] -#[note(lint_controlled_by)] #[note(lint_incoherent)] pub(crate) struct UnexpectedBuiltinCfg { pub(crate) cfg: String, pub(crate) cfg_name: Symbol, + #[subdiagnostic] + pub(crate) controlled_by: Option, +} + +#[derive(Subdiagnostic)] +#[note(lint_unexpected_builtin_cfg_controlled_by)] +pub(crate) struct ControlledBy { pub(crate) controlled_by: &'static str, } diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index b4069b317bfa1..35181866ad7e9 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -827,7 +827,7 @@ pub enum BuiltinLintDiag { UnexpectedBuiltinCfg { cfg: String, cfg_name: Symbol, - controlled_by: &'static str, + controlled_by: Option<&'static str>, }, } diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index cbfe9e0da6adf..8eb01ad247941 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -88,7 +88,7 @@ impl<'a, T: Eq + Hash + Copy + 'a> Extend<&'a T> for ExpectedValues { /// Disallow builtin cfgs from the CLI. pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) { - let disallow = |cfg: &(Symbol, Option), controlled_by| { + let disallow_controlled_by = |cfg: &(Symbol, Option), controlled_by| { let cfg_name = cfg.0; let cfg = if let Some(value) = cfg.1 { format!(r#"{}="{}""#, cfg_name, value) @@ -102,6 +102,9 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) { BuiltinLintDiag::UnexpectedBuiltinCfg { cfg, cfg_name, controlled_by }, ) }; + let disallow = |cfg: &(Symbol, Option), controlled_by| { + disallow_controlled_by(cfg, Some(controlled_by)); + }; // We want to restrict setting builtin cfgs that will produce incoherent behavior // between the cfg and the rustc cli flag that sets it. @@ -147,6 +150,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) { | (sym::target_has_reliable_f128, None | Some(_)) | (sym::target_has_reliable_f128_math, None | Some(_)) | (sym::target_thread_local, None) => disallow(cfg, "--target"), + (sym::has_cfg_version, None) => disallow_controlled_by(cfg, None), (sym::fmt_debug, None | Some(_)) => disallow(cfg, "-Z fmt-debug"), (sym::emscripten_wasm_eh, None | Some(_)) => disallow(cfg, "-Z emscripten_wasm_eh"), _ => {} @@ -310,6 +314,8 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg { ins_none!(sym::contract_checks); } + ins_none!(sym::has_cfg_version); + ret } @@ -472,6 +478,8 @@ impl CheckCfg { ins!(sym::ub_checks, no_values); ins!(sym::contract_checks, no_values); + ins!(sym::has_cfg_version, no_values); + ins!(sym::unix, no_values); ins!(sym::windows, no_values); } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index efae6250b0720..1ba436379f3ac 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1089,6 +1089,7 @@ symbols! { guard_patterns, half_open_range_patterns, half_open_range_patterns_in_slices, + has_cfg_version, hash, hashmap_contains_key, hashmap_drain_ty, diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index 67328defe36b5..8cd57c003282a 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -19,7 +19,6 @@ #![feature(assert_matches)] #![feature(associated_type_defaults)] #![feature(box_patterns)] -#![feature(cfg_version)] #![feature(if_let_guard)] #![feature(iter_intersperse)] #![feature(iterator_try_reduce)] diff --git a/src/doc/unstable-book/src/language-features/cfg-version.md b/src/doc/unstable-book/src/language-features/cfg-version.md deleted file mode 100644 index a6ec42cecba8a..0000000000000 --- a/src/doc/unstable-book/src/language-features/cfg-version.md +++ /dev/null @@ -1,35 +0,0 @@ -# `cfg_version` - -The tracking issue for this feature is: [#64796] - -[#64796]: https://github.com/rust-lang/rust/issues/64796 - ------------------------- - -The `cfg_version` feature makes it possible to execute different code -depending on the compiler version. It will return true if the compiler -version is greater than or equal to the specified version. - -## Examples - -```rust -#![feature(cfg_version)] - -#[cfg(version("1.42"))] // 1.42 and above -fn a() { - // ... -} - -#[cfg(not(version("1.42")))] // 1.41 and below -fn a() { - // ... -} - -fn b() { - if cfg!(version("1.42")) { - // ... - } else { - // ... - } -} -``` diff --git a/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs b/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs index cafb7389e29fa..f825368e51e1f 100644 --- a/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs +++ b/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs @@ -3,8 +3,6 @@ //@ revisions: assume no_assume //@ [assume]compile-flags: -Z assume-incomplete-release -#![feature(cfg_version)] - extern crate ver_cfg_rel; use ver_cfg_rel::ver_cfg_rel; diff --git a/tests/ui/cfg/cfg-version/cfg-version-expand.rs b/tests/ui/cfg/cfg-version/cfg-version-expand.rs new file mode 100644 index 0000000000000..fa2c35d50bc4d --- /dev/null +++ b/tests/ui/cfg/cfg-version/cfg-version-expand.rs @@ -0,0 +1,28 @@ +//@ run-pass +//@ rustc-env:RUSTC_OVERRIDE_VERSION_STRING=1.50.3 + +#[cfg_attr(has_cfg_version, cfg(version("1.49.0")))] +const ON_1_49_0: bool = true; +#[cfg(version("1.50"))] +const ON_1_50_0: bool = true; +#[cfg(not(version("1.51")))] +const ON_1_51_0: bool = false; + +// This one uses the wrong syntax, so doesn't eval to true +#[warn(unexpected_cfgs)] +#[cfg(not(version = "1.48.0"))] //~ WARN unexpected `cfg` condition name: `version` +const ON_1_48_0: bool = false; + +fn main() { + assert!(!ON_1_48_0); + assert!(ON_1_49_0); + assert!(ON_1_50_0); + assert!(!ON_1_51_0); + assert!(cfg!(version("1.1"))); + assert!(cfg!(version("1.49"))); + assert!(cfg!(version("1.50.0"))); + assert!(cfg!(version("1.50.3"))); + assert!(!cfg!(version("1.50.4"))); + assert!(!cfg!(version("1.51"))); + assert!(!cfg!(version("1.100"))); +} diff --git a/tests/ui/cfg/cfg-version/cfg-version-expand.stderr b/tests/ui/cfg/cfg-version/cfg-version-expand.stderr new file mode 100644 index 0000000000000..6f89f9741ab9e --- /dev/null +++ b/tests/ui/cfg/cfg-version/cfg-version-expand.stderr @@ -0,0 +1,13 @@ +warning: unexpected `cfg` condition name: `version` + --> $DIR/cfg-version-expand.rs:13:11 + | +LL | #[cfg(not(version = "1.48.0"))] + | ^^^^^^^^^^^^^^^^^^ + | + = help: expected names are: `FALSE` and `test` and 32 more + = help: to expect this configuration use `--check-cfg=cfg(version, values("1.48.0"))` + = note: see for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/feature-gates/feature-gate-cfg-version.rs b/tests/ui/cfg/cfg-version/cfg-version.rs similarity index 55% rename from tests/ui/feature-gates/feature-gate-cfg-version.rs rename to tests/ui/cfg/cfg-version/cfg-version.rs index e35784a68d101..7df747e282302 100644 --- a/tests/ui/feature-gates/feature-gate-cfg-version.rs +++ b/tests/ui/cfg/cfg-version/cfg-version.rs @@ -1,49 +1,37 @@ #[cfg(version(42))] //~ ERROR: expected a version literal -//~^ ERROR `cfg(version)` is experimental and subject to change fn foo() {} #[cfg(version(1.20))] //~ ERROR: expected a version literal -//~^ ERROR `cfg(version)` is experimental and subject to change +fn foo() -> bool { true } +#[cfg(version = "1.20")] //~ WARN: unexpected `cfg` condition name: `version` fn foo() -> bool { true } #[cfg(version("1.44"))] -//~^ ERROR `cfg(version)` is experimental and subject to change fn foo() -> bool { true } #[cfg(not(version("1.44")))] -//~^ ERROR `cfg(version)` is experimental and subject to change fn foo() -> bool { false } #[cfg(version("1.43", "1.44", "1.45"))] //~ ERROR: expected single version literal -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version(false))] //~ ERROR: expected a version literal -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version("foo"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version("999"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version("-1"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version("65536"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version("0"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { true } #[cfg(version("1.0"))] -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { true } #[cfg(version("1.65536.2"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() -> bool { false } #[cfg(version("1.20.0-stable"))] //~ WARNING: unknown version literal format -//~^ ERROR `cfg(version)` is experimental and subject to change fn bar() {} fn main() { assert!(foo()); assert!(bar()); - assert!(cfg!(version("1.42"))); //~ ERROR `cfg(version)` is experimental and subject to change + assert!(cfg!(version("1.42"))); } diff --git a/tests/ui/cfg/cfg-version/cfg-version.stderr b/tests/ui/cfg/cfg-version/cfg-version.stderr new file mode 100644 index 0000000000000..4fddbc786365e --- /dev/null +++ b/tests/ui/cfg/cfg-version/cfg-version.stderr @@ -0,0 +1,79 @@ +error: expected a version literal + --> $DIR/cfg-version.rs:1:15 + | +LL | #[cfg(version(42))] + | ^^ + +error: expected a version literal + --> $DIR/cfg-version.rs:3:15 + | +LL | #[cfg(version(1.20))] + | ^^^^ + +error: expected single version literal + --> $DIR/cfg-version.rs:12:7 + | +LL | #[cfg(version("1.43", "1.44", "1.45"))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected a version literal + --> $DIR/cfg-version.rs:14:15 + | +LL | #[cfg(version(false))] + | ^^^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:16:15 + | +LL | #[cfg(version("foo"))] + | ^^^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:18:15 + | +LL | #[cfg(version("999"))] + | ^^^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:20:15 + | +LL | #[cfg(version("-1"))] + | ^^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:22:15 + | +LL | #[cfg(version("65536"))] + | ^^^^^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:24:15 + | +LL | #[cfg(version("0"))] + | ^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:28:15 + | +LL | #[cfg(version("1.65536.2"))] + | ^^^^^^^^^^^ + +warning: unknown version literal format, assuming it refers to a future version + --> $DIR/cfg-version.rs:30:15 + | +LL | #[cfg(version("1.20.0-stable"))] + | ^^^^^^^^^^^^^^^ + +warning: unexpected `cfg` condition name: `version` + --> $DIR/cfg-version.rs:5:7 + | +LL | #[cfg(version = "1.20")] + | ^^^^^^^^^^^^^^^^ + | + = help: expected names are: `FALSE` and `test` and 32 more + = help: to expect this configuration use `--check-cfg=cfg(version, values("1.20"))` + = note: see for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +error: aborting due to 4 previous errors; 8 warnings emitted + diff --git a/tests/ui/cfg/disallowed-cli-cfgs.debug_assertions_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.debug_assertions_.stderr index ec3e15b85c79b..e9e464e1b32be 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.debug_assertions_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.debug_assertions_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg debug_assertions` flag | - = note: config `debug_assertions` is only supposed to be controlled by `-C debug-assertions` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `debug_assertions` is only supposed to be controlled by `-C debug-assertions` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr index 8b2ee0e5c0c3d..161ef495e5959 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.emscripten_wasm_eh_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg emscripten_wasm_eh` flag | - = note: config `emscripten_wasm_eh` is only supposed to be controlled by `-Z emscripten_wasm_eh` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `emscripten_wasm_eh` is only supposed to be controlled by `-Z emscripten_wasm_eh` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr index a0d7fa5c3c94a..6ac3f3d6b663a 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg fmt_debug="shallow"` flag | - = note: config `fmt_debug` is only supposed to be controlled by `-Z fmt-debug` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `fmt_debug` is only supposed to be controlled by `-Z fmt-debug` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.has_cfg_version_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.has_cfg_version_.stderr new file mode 100644 index 0000000000000..98989b3b8ffd8 --- /dev/null +++ b/tests/ui/cfg/disallowed-cli-cfgs.has_cfg_version_.stderr @@ -0,0 +1,7 @@ +error: unexpected `--cfg has_cfg_version` flag + | + = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default + +error: aborting due to 1 previous error + diff --git a/tests/ui/cfg/disallowed-cli-cfgs.overflow_checks_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.overflow_checks_.stderr index ba8ed3f2e65d1..6ffdde21a5d3b 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.overflow_checks_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.overflow_checks_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg overflow_checks` flag | - = note: config `overflow_checks` is only supposed to be controlled by `-C overflow-checks` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `overflow_checks` is only supposed to be controlled by `-C overflow-checks` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.panic_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.panic_.stderr index 5b375694b1307..80b10d4740dc3 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.panic_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.panic_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg panic="abort"` flag | - = note: config `panic` is only supposed to be controlled by `-C panic` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `panic` is only supposed to be controlled by `-C panic` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.proc_macro_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.proc_macro_.stderr index c2e2990885727..3d0b2885b0fcf 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.proc_macro_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.proc_macro_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg proc_macro` flag | - = note: config `proc_macro` is only supposed to be controlled by `--crate-type proc-macro` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `proc_macro` is only supposed to be controlled by `--crate-type proc-macro` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_.stderr index 1b6e05060017e..603dba236c4b1 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_reliable_f128` flag | - = note: config `target_has_reliable_f128` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_reliable_f128` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_math_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_math_.stderr index 86e7342b8fc1e..9fc175fa60f85 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_math_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f128_math_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_reliable_f128_math` flag | - = note: config `target_has_reliable_f128_math` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_reliable_f128_math` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_.stderr index cf5000ecf2741..b761aec863c19 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_reliable_f16` flag | - = note: config `target_has_reliable_f16` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_reliable_f16` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_math_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_math_.stderr index 079e5627e4c2b..d6792d5bebbb3 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_math_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.reliable_f16_math_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_reliable_f16_math` flag | - = note: config `target_has_reliable_f16_math` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_reliable_f16_math` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.relocation_model_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.relocation_model_.stderr index 65ada551cba92..44c008bd511c1 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.relocation_model_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.relocation_model_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg relocation_model="a"` flag | - = note: config `relocation_model` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `relocation_model` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.rs b/tests/ui/cfg/disallowed-cli-cfgs.rs index f7f9d2b5cd7f9..8e46616a34faa 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.rs +++ b/tests/ui/cfg/disallowed-cli-cfgs.rs @@ -9,6 +9,7 @@ //@ revisions: fmt_debug_ //@ revisions: emscripten_wasm_eh_ //@ revisions: reliable_f16_ reliable_f16_math_ reliable_f128_ reliable_f128_math_ +//@ revisions: has_cfg_version_ //@ [overflow_checks_]compile-flags: --cfg overflow_checks //@ [debug_assertions_]compile-flags: --cfg debug_assertions @@ -40,6 +41,7 @@ //@ [reliable_f16_math_]compile-flags: --cfg target_has_reliable_f16_math //@ [reliable_f128_]compile-flags: --cfg target_has_reliable_f128 //@ [reliable_f128_math_]compile-flags: --cfg target_has_reliable_f128_math +//@ [has_cfg_version_]compile-flags: --cfg has_cfg_version fn main() {} diff --git a/tests/ui/cfg/disallowed-cli-cfgs.sanitize_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.sanitize_.stderr index b1f3b19dd8668..dbaa857a7c7c7 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.sanitize_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.sanitize_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg sanitize="cfi"` flag | - = note: config `sanitize` is only supposed to be controlled by `-Z sanitizer` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `sanitize` is only supposed to be controlled by `-Z sanitizer` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_generalize_pointers_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_generalize_pointers_.stderr index 49106f99b6bc8..ccd86506e9a80 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_generalize_pointers_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_generalize_pointers_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg sanitizer_cfi_generalize_pointers` flag | - = note: config `sanitizer_cfi_generalize_pointers` is only supposed to be controlled by `-Z sanitizer=cfi` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `sanitizer_cfi_generalize_pointers` is only supposed to be controlled by `-Z sanitizer=cfi` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_normalize_integers_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_normalize_integers_.stderr index f9bb9e76297aa..3a16963bc0773 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_normalize_integers_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.sanitizer_cfi_normalize_integers_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg sanitizer_cfi_normalize_integers` flag | - = note: config `sanitizer_cfi_normalize_integers` is only supposed to be controlled by `-Z sanitizer=cfi` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `sanitizer_cfi_normalize_integers` is only supposed to be controlled by `-Z sanitizer=cfi` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_abi_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_abi_.stderr index f5c09110ce855..09a7541c952b8 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_abi_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_abi_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_abi="gnu"` flag | - = note: config `target_abi` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_abi` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_arch_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_arch_.stderr index 7f616e75d4e1a..2574c03a85c2a 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_arch_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_arch_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_arch="arm"` flag | - = note: config `target_arch` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_arch` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_endian_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_endian_.stderr index 755f3708d67f2..dc457c87ae297 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_endian_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_endian_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_endian="little"` flag | - = note: config `target_endian` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_endian` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_env_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_env_.stderr index ccd027dbebec7..81935eca4b819 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_env_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_env_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_env` flag | - = note: config `target_env` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_env` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_family_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_family_.stderr index e376e4e16a19b..8fda08679325e 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_family_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_family_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_family="unix"` flag | - = note: config `target_family` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_family` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_feature_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_feature_.stderr index 457cca6b8854e..8be2c1094183c 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_feature_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_feature_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_feature="sse3"` flag | - = note: config `target_feature` is only supposed to be controlled by `-C target-feature` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_feature` is only supposed to be controlled by `-C target-feature` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_.stderr index 160741198ad89..faff94e03cefb 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_atomic="32"` flag | - = note: config `target_has_atomic` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_atomic` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_equal_alignment_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_equal_alignment_.stderr index 096490a03f610..2741545ce5aea 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_equal_alignment_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_equal_alignment_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_atomic_equal_alignment="32"` flag | - = note: config `target_has_atomic_equal_alignment` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_atomic_equal_alignment` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_load_store_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_load_store_.stderr index 5253987cb1262..b45fce36ce0a8 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_load_store_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_load_store_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_has_atomic_load_store="32"` flag | - = note: config `target_has_atomic_load_store` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_has_atomic_load_store` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_os_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_os_.stderr index ba2c967bfa165..c644cc3b00131 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_os_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_os_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_os="linux"` flag | - = note: config `target_os` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_os` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_pointer_width_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_pointer_width_.stderr index 983313bc51724..00b0a474c2483 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_pointer_width_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_pointer_width_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_pointer_width="32"` flag | - = note: config `target_pointer_width` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_pointer_width` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_thread_local_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_thread_local_.stderr index 4f66ea17ee409..d376dede6a6b3 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_thread_local_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_thread_local_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_thread_local` flag | - = note: config `target_thread_local` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_thread_local` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.target_vendor_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.target_vendor_.stderr index e8f3259844592..8928da07d18f7 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.target_vendor_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.target_vendor_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg target_vendor` flag | - = note: config `target_vendor` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `target_vendor` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.ub_checks_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.ub_checks_.stderr index e61e5ac69d526..74d2570232484 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.ub_checks_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.ub_checks_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg ub_checks` flag | - = note: config `ub_checks` is only supposed to be controlled by `-Z ub-checks` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `ub_checks` is only supposed to be controlled by `-Z ub-checks` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.unix_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.unix_.stderr index f3c6bb0ef1b06..973112954fb25 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.unix_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.unix_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg unix` flag | - = note: config `unix` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `unix` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/cfg/disallowed-cli-cfgs.windows_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.windows_.stderr index 171a3f95bbd46..f4aa635d3ac7e 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.windows_.stderr +++ b/tests/ui/cfg/disallowed-cli-cfgs.windows_.stderr @@ -1,7 +1,7 @@ error: unexpected `--cfg windows` flag | - = note: config `windows` is only supposed to be controlled by `--target` = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: config `windows` is only supposed to be controlled by `--target` = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr index 03a7156a4d69e..6039af936a319 100644 --- a/tests/ui/check-cfg/cargo-build-script.stderr +++ b/tests/ui/check-cfg/cargo-build-script.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo` LL | #[cfg(has_foo)] | ^^^^^^^ | - = help: expected names are: `has_bar` and 31 more + = help: expected names are: `has_bar` and 32 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index b83d1794984de..c710781b68ce9 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `docsrs`, `feature`, and `test` and 31 more + = help: expected names are: `docsrs`, `feature`, and `test` and 32 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 2cddcbbcd7f9e..9e3726f6c6259 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 31 more + = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 32 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index 68e1259dbb842..ed80d25ffccda 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 31 more + = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 32 more = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index 5279f3b09015d..5e0f1b02dd459 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar` and `foo` and 31 more + = help: expected names are: `bar` and `foo` and 32 more = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index 80f8f36c23f78..33dafdcca975a 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 31 more + = help: expected names are: `feature` and 32 more = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index 80f8f36c23f78..33dafdcca975a 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 31 more + = help: expected names are: `feature` and 32 more = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index be4d7c7727636..b42619b04e9bf 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, unix)] | ^^ | - = help: expected names are: `feature` and 31 more + = help: expected names are: `feature` and 32 more = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2015.stderr b/tests/ui/check-cfg/raw-keywords.edition2015.stderr index 29c1a71c0b7a6..1524c3558fc95 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2015.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2015.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 31 more + = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 32 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2021.stderr b/tests/ui/check-cfg/raw-keywords.edition2021.stderr index cc3702685fd2c..5859b7592941a 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2021.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2021.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 31 more + = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 32 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr index 989a01f224412..9d2710d5a5430 100644 --- a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 31 more + = help: expected names are: `feature` and 32 more = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: the macro `cfg_macro::my_lib_macro` may come from an old version of the `cfg_macro` crate, try updating your dependency with `cargo update -p cfg_macro` diff --git a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr index 95d10e014f33b..2d27e4f97c266 100644 --- a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 31 more + = help: expected names are: `feature` and 32 more = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)` diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 4edf608589d5c..13cc56501871c 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -10,6 +10,7 @@ LL | #[cfg(list_all_well_known_cfgs)] `doc` `doctest` `fmt_debug` +`has_cfg_version` `miri` `overflow_checks` `panic` diff --git a/tests/ui/feature-gates/feature-gate-cfg-version.stderr b/tests/ui/feature-gates/feature-gate-cfg-version.stderr deleted file mode 100644 index c1c3e8e5897a6..0000000000000 --- a/tests/ui/feature-gates/feature-gate-cfg-version.stderr +++ /dev/null @@ -1,219 +0,0 @@ -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:1:7 - | -LL | #[cfg(version(42))] - | ^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: expected a version literal - --> $DIR/feature-gate-cfg-version.rs:1:15 - | -LL | #[cfg(version(42))] - | ^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:4:7 - | -LL | #[cfg(version(1.20))] - | ^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: expected a version literal - --> $DIR/feature-gate-cfg-version.rs:4:15 - | -LL | #[cfg(version(1.20))] - | ^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:7:7 - | -LL | #[cfg(version("1.44"))] - | ^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:10:11 - | -LL | #[cfg(not(version("1.44")))] - | ^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:14:7 - | -LL | #[cfg(version("1.43", "1.44", "1.45"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: expected single version literal - --> $DIR/feature-gate-cfg-version.rs:14:7 - | -LL | #[cfg(version("1.43", "1.44", "1.45"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:17:7 - | -LL | #[cfg(version(false))] - | ^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: expected a version literal - --> $DIR/feature-gate-cfg-version.rs:17:15 - | -LL | #[cfg(version(false))] - | ^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:20:7 - | -LL | #[cfg(version("foo"))] - | ^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:20:15 - | -LL | #[cfg(version("foo"))] - | ^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:23:7 - | -LL | #[cfg(version("999"))] - | ^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:23:15 - | -LL | #[cfg(version("999"))] - | ^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:26:7 - | -LL | #[cfg(version("-1"))] - | ^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:26:15 - | -LL | #[cfg(version("-1"))] - | ^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:29:7 - | -LL | #[cfg(version("65536"))] - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:29:15 - | -LL | #[cfg(version("65536"))] - | ^^^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:32:7 - | -LL | #[cfg(version("0"))] - | ^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:32:15 - | -LL | #[cfg(version("0"))] - | ^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:35:7 - | -LL | #[cfg(version("1.0"))] - | ^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:38:7 - | -LL | #[cfg(version("1.65536.2"))] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:38:15 - | -LL | #[cfg(version("1.65536.2"))] - | ^^^^^^^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:41:7 - | -LL | #[cfg(version("1.20.0-stable"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -warning: unknown version literal format, assuming it refers to a future version - --> $DIR/feature-gate-cfg-version.rs:41:15 - | -LL | #[cfg(version("1.20.0-stable"))] - | ^^^^^^^^^^^^^^^ - -error[E0658]: `cfg(version)` is experimental and subject to change - --> $DIR/feature-gate-cfg-version.rs:48:18 - | -LL | assert!(cfg!(version("1.42"))); - | ^^^^^^^^^^^^^^^ - | - = note: see issue #64796 for more information - = help: add `#![feature(cfg_version)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 19 previous errors; 7 warnings emitted - -For more information about this error, try `rustc --explain E0658`.