New force_warn diagnostic builder and ensure cap-lints doesn't reduce force_warn level

This commit is contained in:
Ryan Levick 2021-07-01 12:29:20 +02:00
parent a3d6905053
commit 33cc7b1fe2
7 changed files with 67 additions and 15 deletions

View file

@ -0,0 +1,15 @@
// compile-flags: --cap-lints warn --force-warns rust-2021-compatibility -Zunstable-options
// check-pass
#![allow(ellipsis_inclusive_range_patterns)]
pub fn f() -> bool {
let x = 123;
match x {
0...100 => true,
//~^ WARN range patterns are deprecated
//~| WARN this is accepted in the current edition
_ => false,
}
}
fn main() {}

View file

@ -0,0 +1,12 @@
warning: `...` range patterns are deprecated
--> $DIR/force-warn-cap-lints-warn.rs:8:10
|
LL | 0...100 => true,
| ^^^ help: use `..=` for an inclusive range
|
= note: `--force-warns ellipsis-inclusive-range-patterns` implied by `--force-warns rust-2021-compatibility`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
warning: 1 warning emitted

View file

@ -1,5 +1,5 @@
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/force-warns-cap-lints.rs:6:25
--> $DIR/force-warns-cap-lints-allow.rs:6:25
|
LL | pub fn function(_x: Box<SomeTrait>) {}
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`