Suggest correct version("..") predicate syntax in check-cfg
This commit is contained in:
parent
d423c815a6
commit
343fecabc7
6 changed files with 64 additions and 0 deletions
14
tests/ui/check-cfg/wrong-version-syntax.fixed
Normal file
14
tests/ui/check-cfg/wrong-version-syntax.fixed
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Check warning for wrong `cfg(version("1.27"))` syntax
|
||||
//
|
||||
//@ check-pass
|
||||
//@ no-auto-check-cfg
|
||||
//@ compile-flags: --check-cfg=cfg()
|
||||
//@ run-rustfix
|
||||
|
||||
#![feature(cfg_version)]
|
||||
|
||||
#[cfg(not(version("1.48.0")))]
|
||||
//~^ WARNING unexpected `cfg` condition name: `version`
|
||||
pub fn g() {}
|
||||
|
||||
pub fn main() {}
|
||||
14
tests/ui/check-cfg/wrong-version-syntax.rs
Normal file
14
tests/ui/check-cfg/wrong-version-syntax.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Check warning for wrong `cfg(version("1.27"))` syntax
|
||||
//
|
||||
//@ check-pass
|
||||
//@ no-auto-check-cfg
|
||||
//@ compile-flags: --check-cfg=cfg()
|
||||
//@ run-rustfix
|
||||
|
||||
#![feature(cfg_version)]
|
||||
|
||||
#[cfg(not(version = "1.48.0"))]
|
||||
//~^ WARNING unexpected `cfg` condition name: `version`
|
||||
pub fn g() {}
|
||||
|
||||
pub fn main() {}
|
||||
17
tests/ui/check-cfg/wrong-version-syntax.stderr
Normal file
17
tests/ui/check-cfg/wrong-version-syntax.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
warning: unexpected `cfg` condition name: `version`
|
||||
--> $DIR/wrong-version-syntax.rs:10:11
|
||||
|
|
||||
LL | #[cfg(not(version = "1.48.0"))]
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: to expect this configuration use `--check-cfg=cfg(version, values("1.48.0"))`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
help: there is a similar config predicate: `version("..")`
|
||||
|
|
||||
LL - #[cfg(not(version = "1.48.0"))]
|
||||
LL + #[cfg(not(version("1.48.0")))]
|
||||
|
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue