diff options
| author | bors <bors@rust-lang.org> | 2023-01-17 04:25:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-17 04:25:53 +0000 |
| commit | 85357e3e2ed5f4ae4760d4418bbeab9985a784aa (patch) | |
| tree | a06ef4ab57aa35b7ba5f99fd72efa04ad25b8ed9 /tests/ui/pattern | |
| parent | 4781233a77e879e49cb5ce3c98d2abba6a6ade7a (diff) | |
| parent | d6e79ab9c859cb06da0798f24ac31e1e33c932d3 (diff) | |
| download | rust-85357e3e2ed5f4ae4760d4418bbeab9985a784aa.tar.gz rust-85357e3e2ed5f4ae4760d4418bbeab9985a784aa.zip | |
Auto merge of #106966 - matthiaskrgr:rollup-e34pevi, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #106591 (suggestion for attempted integer identifier in patterns) - #106712 (make error emitted on `impl &Trait` nicer) - #106829 (Unify `Opaque`/`Projection` handling in region outlives code) - #106869 (rustdoc: remove redundant item kind class from `.item-decl > pre`) - #106949 (ConstBlocks are poly if their substs are poly) - #106953 (Document `EarlyBinder::subst_identity` and `skip_binder`) - #106958 (Don't add A-bootstrap to PRs modifying Cargo.lock) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/pattern')
| -rw-r--r-- | tests/ui/pattern/issue-106552.rs | 7 | ||||
| -rw-r--r-- | tests/ui/pattern/issue-106552.stderr | 35 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/ui/pattern/issue-106552.rs b/tests/ui/pattern/issue-106552.rs new file mode 100644 index 00000000000..aa2c141e05e --- /dev/null +++ b/tests/ui/pattern/issue-106552.rs @@ -0,0 +1,7 @@ +fn main() { + let 5 = 6; + //~^ error refutable pattern in local binding [E0005] + + let x @ 5 = 6; + //~^ error refutable pattern in local binding [E0005] +} diff --git a/tests/ui/pattern/issue-106552.stderr b/tests/ui/pattern/issue-106552.stderr new file mode 100644 index 00000000000..ed5d40c0968 --- /dev/null +++ b/tests/ui/pattern/issue-106552.stderr @@ -0,0 +1,35 @@ +error[E0005]: refutable pattern in local binding + --> $DIR/issue-106552.rs:2:9 + | +LL | let 5 = 6; + | ^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `i32` +help: you might want to use `if let` to ignore the variants that aren't matched + | +LL | if let 5 = 6 { todo!() } + | ++ ~~~~~~~~~~~ +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | let _5 = 6; + | + + +error[E0005]: refutable pattern in local binding + --> $DIR/issue-106552.rs:5:9 + | +LL | let x @ 5 = 6; + | ^^^^^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `i32` +help: you might want to use `let else` to handle the variants that aren't matched + | +LL | let x @ 5 = 6 else { todo!() }; + | ++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0005`. |
