diff options
| author | Urgau <urgau@numericable.fr> | 2023-11-19 21:41:55 +0100 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2023-11-21 19:06:58 +0100 |
| commit | 1c37997fa70129efea84c02cf4d863a44660ab2e (patch) | |
| tree | f669ffb2c49262a0b1733cfc295de933436b1efd /tests | |
| parent | 9f15acec474dafe50617aa1623c987e3b6354246 (diff) | |
| download | rust-1c37997fa70129efea84c02cf4d863a44660ab2e.tar.gz rust-1c37997fa70129efea84c02cf4d863a44660ab2e.zip | |
Improve diagnostic for unexpected feature config name from Cargo
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/check-cfg/cargo-feature.rs | 14 | ||||
| -rw-r--r-- | tests/ui/check-cfg/cargo-feature.stderr | 11 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/check-cfg/cargo-feature.rs b/tests/ui/check-cfg/cargo-feature.rs new file mode 100644 index 00000000000..ea48c6ea201 --- /dev/null +++ b/tests/ui/check-cfg/cargo-feature.rs @@ -0,0 +1,14 @@ +// This test checks that when no features are passed by Cargo we +// suggest adding some in the Cargo.toml instead of vomitting a +// list of all the expected names +// +// check-pass +// rustc-env:CARGO=/usr/bin/cargo +// compile-flags: --check-cfg=cfg() -Z unstable-options +// error-pattern:Cargo.toml + +#[cfg(feature = "serde")] +//~^ WARNING unexpected `cfg` condition name +fn ser() {} + +fn main() {} diff --git a/tests/ui/check-cfg/cargo-feature.stderr b/tests/ui/check-cfg/cargo-feature.stderr new file mode 100644 index 00000000000..619410a28f3 --- /dev/null +++ b/tests/ui/check-cfg/cargo-feature.stderr @@ -0,0 +1,11 @@ +warning: unexpected `cfg` condition name: `feature` + --> $DIR/cargo-feature.rs:10:7 + | +LL | #[cfg(feature = "serde")] + | ^^^^^^^^^^^^^^^^^ + | + = help: consider defining some features in `Cargo.toml` + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + |
