stabilize check-cfg suggestions

This commit is contained in:
yukang
2026-04-06 21:26:03 +08:00
parent 906ca7ff5e
commit 43ec6207bb
3 changed files with 11 additions and 9 deletions
@@ -438,10 +438,10 @@ pub(super) fn unexpected_cfg_value(
}
}
/// Ordering of the output is not stable, use this only in diagnostic code.
fn possible_well_known_names_for_cfg_value(sess: &Session, value: Symbol) -> Vec<Symbol> {
#[allow(rustc::potential_query_instability)]
sess.psess
let mut names = sess
.psess
.check_config
.well_known_names
.iter()
@@ -454,5 +454,7 @@ fn possible_well_known_names_for_cfg_value(sess: &Session, value: Symbol) -> Vec
.unwrap_or_default()
})
.copied()
.collect()
.collect::<Vec<_>>();
names.sort_by(|a, b| a.as_str().cmp(b.as_str()));
names
}
@@ -32,8 +32,8 @@
#[cfg(target_abi = "windows")]
//~^ ERROR unexpected `cfg` condition value:
//~| NOTE see <https://doc.rust-lang.org
//~| HELP `windows` is an expected value for `target_os`
//~| HELP `windows` is an expected value for `target_family`
//~| HELP `windows` is an expected value for `target_os`
struct E;
fn main() {}
@@ -62,16 +62,16 @@ LL | #[cfg(target_abi = "windows")]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
help: `windows` is an expected value for `target_os`
|
LL - #[cfg(target_abi = "windows")]
LL + #[cfg(target_os = "windows")]
|
help: `windows` is an expected value for `target_family`
|
LL - #[cfg(target_abi = "windows")]
LL + #[cfg(target_family = "windows")]
|
help: `windows` is an expected value for `target_os`
|
LL - #[cfg(target_abi = "windows")]
LL + #[cfg(target_os = "windows")]
|
error: aborting due to 5 previous errors