mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Mark crash 140011 as fixed
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
//@ known-bug: #140011
|
||||
//@compile-flags: -Wrust-2021-incompatible-closure-captures
|
||||
enum b {
|
||||
c(d),
|
||||
e(f),
|
||||
}
|
||||
struct f;
|
||||
fn g() {
|
||||
let h;
|
||||
|| b::e(a) = h;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//@compile-flags: -Wrust-2021-incompatible-closure-captures
|
||||
enum B {
|
||||
C(D), //~ ERROR: cannot find type `D` in this scope
|
||||
E(F),
|
||||
}
|
||||
struct F;
|
||||
fn f(h: B) {
|
||||
|| {
|
||||
let B::E(a) = h; //~ ERROR: refutable pattern in local binding
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,36 @@
|
||||
error[E0412]: cannot find type `D` in this scope
|
||||
--> $DIR/malformed-pattern-issue-140011.rs:3:7
|
||||
|
|
||||
LL | C(D),
|
||||
| ^ not found in this scope
|
||||
|
|
||||
help: you might be missing a type parameter
|
||||
|
|
||||
LL | enum B<D> {
|
||||
| +++
|
||||
|
||||
error[E0005]: refutable pattern in local binding
|
||||
--> $DIR/malformed-pattern-issue-140011.rs:9:13
|
||||
|
|
||||
LL | let B::E(a) = h;
|
||||
| ^^^^^^^ pattern `B::C(_)` 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/ch19-02-refutability.html
|
||||
note: `B` defined here
|
||||
--> $DIR/malformed-pattern-issue-140011.rs:2:6
|
||||
|
|
||||
LL | enum B {
|
||||
| ^
|
||||
LL | C(D),
|
||||
| - not covered
|
||||
= note: the matched value is of type `B`
|
||||
help: you might want to use `let else` to handle the variant that isn't matched
|
||||
|
|
||||
LL | let B::E(a) = h else { todo!() };
|
||||
| ++++++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0005, E0412.
|
||||
For more information about an error, try `rustc --explain E0005`.
|
||||
Reference in New Issue
Block a user