Skip to content

Rollup of 5 pull requests #125320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
05f77d1
Update `unexpected_cfgs` lint for Cargo new `check-cfg` config
Urgau May 16, 2024
e6396bc
Use a single static for all default slice Arcs.
zachs18 May 11, 2024
2dacd70
Fix stacked borrows violation
zachs18 May 19, 2024
7cb84fb
Prefer suggesting string-literal for Cargo `check-cfg` lint config
Urgau May 16, 2024
b5ec9bb
Add Cargo specific doc regarding his interaction with `--check-cfg`
Urgau May 16, 2024
3b47f4c
Refer to the Cargo specific doc in the check-cfg diagnostics
Urgau May 17, 2024
bc8e034
Link to the check-cfg doc section in the `unexpected_cfgs` lint doc
Urgau May 17, 2024
6fae171
fmt
zachs18 May 19, 2024
58f8ed1
cfg-out unused code under no_global_oom_handling
zachs18 May 19, 2024
3299823
Fix typo in assert message
zachs18 May 19, 2024
91685c0
Make search graph generic over interner
compiler-errors May 18, 2024
9dc073a
Make EvalCtxt generic over interner
compiler-errors May 18, 2024
dbfed2c
Add failing test for cross-crate enum in type alias
compiler-errors May 20, 2024
090dbb1
Don't strip items with inherited visibility in AliasedNonLocalStripper
compiler-errors May 20, 2024
4654e87
Fix `tests/debuginfo/strings-and-strs`.
nnethercote May 20, 2024
ccd3e99
Fix quote escaping inside check-cfg value
Urgau May 20, 2024
86e0458
Rollup merge of #125219 - Urgau:check-cfg-cargo-config, r=fmease
matthiaskrgr May 20, 2024
81744f1
Rollup merge of #125255 - compiler-errors:eval-ctxt-generic, r=lcnr
matthiaskrgr May 20, 2024
78db21b
Rollup merge of #125283 - zachs18:arc-default-shared, r=dtolnay
matthiaskrgr May 20, 2024
e667eb6
Rollup merge of #125300 - compiler-errors:dont-strip-inherited-viz, r…
matthiaskrgr May 20, 2024
b937bd3
Rollup merge of #125309 - nnethercote:fix-strings-and-strs, r=Mark-Si…
matthiaskrgr May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refer to the Cargo specific doc in the check-cfg diagnostics
  • Loading branch information
Urgau committed May 19, 2024
commit 3b47f4c60c736ee965f2e4d4296bd27d1d69effb
6 changes: 4 additions & 2 deletions compiler/rustc_lint/src/context/diagnostics/check_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ pub(super) fn unexpected_cfg_name(
diag.help(format!("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = ['{}'] }}", inst(EscapeQuotes::No)));
diag.help(format!("or consider adding `println!(\"cargo::rustc-check-cfg={}\");` to the top of the `build.rs`", inst(EscapeQuotes::Yes)));
}
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration");
} else {
let inst = inst(EscapeQuotes::No);
diag.help(format!("to expect this configuration use `--check-cfg={inst}`",));
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
}
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
}

pub(super) fn unexpected_cfg_value(
Expand Down Expand Up @@ -281,11 +282,12 @@ pub(super) fn unexpected_cfg_value(
diag.help(format!("or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:\n [lints.rust]\n unexpected_cfgs = {{ level = \"warn\", check-cfg = ['{}'] }}", inst(EscapeQuotes::No)));
diag.help(format!("or consider adding `println!(\"cargo::rustc-check-cfg={}\");` to the top of the `build.rs`", inst(EscapeQuotes::Yes)));
}
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration");
} else {
if !is_cfg_a_well_know_name {
let inst = inst(EscapeQuotes::No);
diag.help(format!("to expect this configuration use `--check-cfg={inst}`",));
}
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
}
diag.note("see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration");
}
8 changes: 4 additions & 4 deletions tests/ui/check-cfg/cargo-feature.none.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")]
|
= note: no expected values for `feature`
= help: consider adding `serde` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: (none)
Expand All @@ -17,7 +17,7 @@ LL | #[cfg(feature)]
|
= note: no expected values for `feature`
= help: consider defining some features in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `tokio_unstable`
--> $DIR/cargo-feature.rs:22:7
Expand All @@ -31,7 +31,7 @@ LL | #[cfg(tokio_unstable)]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `CONFIG_NVME`
--> $DIR/cargo-feature.rs:26:7
Expand All @@ -44,7 +44,7 @@ LL | #[cfg(CONFIG_NVME = "m")]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(CONFIG_NVME, values("m"))'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: 4 warnings emitted

8 changes: 4 additions & 4 deletions tests/ui/check-cfg/cargo-feature.some.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")]
|
= note: expected values for `feature` are: `bitcode`
= help: consider adding `serde` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: (none)
Expand All @@ -17,7 +17,7 @@ LL | #[cfg(feature)]
|
= note: expected values for `feature` are: `bitcode`
= help: consider defining some features in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `tokio_unstable`
--> $DIR/cargo-feature.rs:22:7
Expand All @@ -31,7 +31,7 @@ LL | #[cfg(tokio_unstable)]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `m`
--> $DIR/cargo-feature.rs:26:7
Expand All @@ -47,7 +47,7 @@ LL | #[cfg(CONFIG_NVME = "m")]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(CONFIG_NVME, values("m"))'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: 4 warnings emitted

12 changes: 6 additions & 6 deletions tests/ui/check-cfg/diagnotics.cargo.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #[cfg(featur)]
| ^^^^^^ help: there is a config with a similar name: `feature`
|
= help: expected values for `feature` are: `foo`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition name: `featur`
Expand All @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `featur`
LL | #[cfg(featur = "foo")]
| ^^^^^^^^^^^^^^
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
help: there is a config with a similar name and value
|
LL | #[cfg(feature = "foo")]
Expand All @@ -27,7 +27,7 @@ LL | #[cfg(featur = "fo")]
| ^^^^^^^^^^^^^
|
= help: expected values for `feature` are: `foo`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
help: there is a config with a similar name and different values
|
LL | #[cfg(feature = "foo")]
Expand All @@ -44,7 +44,7 @@ LL | #[cfg(no_value)]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(no_value)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(no_value)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `no_value`
--> $DIR/diagnotics.rs:27:7
Expand All @@ -57,7 +57,7 @@ LL | #[cfg(no_value = "foo")]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(no_value, values("foo"))'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
help: there is a config with a similar name and no value
|
LL | #[cfg(no_values)]
Expand All @@ -77,7 +77,7 @@ LL | #[cfg(no_values = "bar")]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(no_values, values("bar"))'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: 6 warnings emitted