diff options
Diffstat (limited to 'src/test/ui/pattern')
6 files changed, 39 insertions, 4 deletions
diff --git a/src/test/ui/pattern/issue-17718-patterns.rs b/src/test/ui/pattern/issue-17718-patterns.rs new file mode 100644 index 000000000..2ca0f67f8 --- /dev/null +++ b/src/test/ui/pattern/issue-17718-patterns.rs @@ -0,0 +1,12 @@ +static A1: usize = 1; +static mut A2: usize = 1; +const A3: usize = 1; + +fn main() { + match 1 { + A1 => {} //~ ERROR: match bindings cannot shadow statics + A2 => {} //~ ERROR: match bindings cannot shadow statics + A3 => {} + _ => {} + } +} diff --git a/src/test/ui/pattern/issue-17718-patterns.stderr b/src/test/ui/pattern/issue-17718-patterns.stderr new file mode 100644 index 000000000..109091c2a --- /dev/null +++ b/src/test/ui/pattern/issue-17718-patterns.stderr @@ -0,0 +1,21 @@ +error[E0530]: match bindings cannot shadow statics + --> $DIR/issue-17718-patterns.rs:7:9 + | +LL | static A1: usize = 1; + | --------------------- the static `A1` is defined here +... +LL | A1 => {} + | ^^ cannot be named the same as a static + +error[E0530]: match bindings cannot shadow statics + --> $DIR/issue-17718-patterns.rs:8:9 + | +LL | static mut A2: usize = 1; + | ------------------------- the static `A2` is defined here +... +LL | A2 => {} + | ^^ cannot be named the same as a static + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0530`. diff --git a/src/test/ui/pattern/issue-66270-pat-struct-parser-recovery.stderr b/src/test/ui/pattern/issue-66270-pat-struct-parser-recovery.stderr index fef0f3c0e..f40642f30 100644 --- a/src/test/ui/pattern/issue-66270-pat-struct-parser-recovery.stderr +++ b/src/test/ui/pattern/issue-66270-pat-struct-parser-recovery.stderr @@ -1,6 +1,8 @@ error: expected type, found `0` --> $DIR/issue-66270-pat-struct-parser-recovery.rs:4:22 | +LL | struct Bug { + | --- while parsing this struct LL | incorrect_field: 0, | ^ expected type diff --git a/src/test/ui/pattern/usefulness/consts-opaque.stderr b/src/test/ui/pattern/usefulness/consts-opaque.stderr index 05c009a6f..35396751a 100644 --- a/src/test/ui/pattern/usefulness/consts-opaque.stderr +++ b/src/test/ui/pattern/usefulness/consts-opaque.stderr @@ -40,9 +40,9 @@ warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated w LL | FOO_REF_REF => {} | ^^^^^^^^^^^ | - = note: `#[warn(indirect_structural_match)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411> + = note: `#[warn(indirect_structural_match)]` on by default error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/consts-opaque.rs:53:9 diff --git a/src/test/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr b/src/test/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr index b97683526..cdb6b5c7a 100644 --- a/src/test/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr +++ b/src/test/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr @@ -4,13 +4,13 @@ error: irrefutable `if let` pattern LL | if let _ = 5 {} | ^^^^^^^^^ | + = note: this pattern will always match, so the `if let` is useless + = help: consider replacing the `if let` with a `let` note: the lint level is defined here --> $DIR/deny-irrefutable-let-patterns.rs:3:9 | LL | #![deny(irrefutable_let_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this pattern will always match, so the `if let` is useless - = help: consider replacing the `if let` with a `let` error: irrefutable `while let` pattern --> $DIR/deny-irrefutable-let-patterns.rs:8:11 diff --git a/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr b/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr index 24c0419e1..ea0e8f6e4 100644 --- a/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr +++ b/src/test/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr @@ -6,12 +6,12 @@ LL | m!(0u8, 20..=30, 30..=40); | | | this range overlaps on `30_u8`... | + = note: you likely meant to write mutually exclusive ranges note: the lint level is defined here --> $DIR/overlapping_range_endpoints.rs:2:9 | LL | #![deny(overlapping_range_endpoints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints --> $DIR/overlapping_range_endpoints.rs:16:22 |