about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr4
-rw-r--r--tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr8
-rw-r--r--tests/ui/let-else/uninitialized-refutable-let-issue-123844.rs8
-rw-r--r--tests/ui/let-else/uninitialized-refutable-let-issue-123844.stderr13
-rw-r--r--tests/ui/parser/recover/recover-range-pats.stderr36
5 files changed, 21 insertions, 48 deletions
diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
index 6832f21f25e..0d2aae689f0 100644
--- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
+++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
@@ -46,10 +46,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let ...$e; { todo!() }
-   |             ++            +++++++++++
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr
index cb9e48e70e3..9ba0e09e154 100644
--- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr
+++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-no-end.stderr
@@ -67,10 +67,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let $e...; { todo!() }
-   |             ++            +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/half-open-range-pats-inclusive-no-end.rs:20:17
@@ -85,10 +81,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let $e..=; { todo!() }
-   |             ++            +++++++++++
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/let-else/uninitialized-refutable-let-issue-123844.rs b/tests/ui/let-else/uninitialized-refutable-let-issue-123844.rs
new file mode 100644
index 00000000000..8426b0021f4
--- /dev/null
+++ b/tests/ui/let-else/uninitialized-refutable-let-issue-123844.rs
@@ -0,0 +1,8 @@
+// https://github.com/rust-lang/rust/issues/123844
+// An uninitialized refutable let should not suggest `let else`, as it can't be used with deferred
+// initialization.
+
+fn main() {
+    let Some(x); //~ ERROR refutable pattern in local binding
+    x = 1;
+}
diff --git a/tests/ui/let-else/uninitialized-refutable-let-issue-123844.stderr b/tests/ui/let-else/uninitialized-refutable-let-issue-123844.stderr
new file mode 100644
index 00000000000..13312306c07
--- /dev/null
+++ b/tests/ui/let-else/uninitialized-refutable-let-issue-123844.stderr
@@ -0,0 +1,13 @@
+error[E0005]: refutable pattern in local binding
+  --> $DIR/uninitialized-refutable-let-issue-123844.rs:6:9
+   |
+LL |     let Some(x);
+   |         ^^^^^^^ pattern `None` 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 `Option<i32>`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr
index 7c5cc4777b6..2c0baf7e5f8 100644
--- a/tests/ui/parser/recover/recover-range-pats.stderr
+++ b/tests/ui/parser/recover/recover-range-pats.stderr
@@ -491,10 +491,6 @@ LL |     mac2!(0, 1);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variants that aren't matched
-   |
-LL |             if let $e1..$e2; { todo!() }
-   |             ++               +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:138:17
@@ -509,10 +505,6 @@ LL |     mac2!(0, 1);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variants that aren't matched
-   |
-LL |             if let $e1...$e2; { todo!() }
-   |             ++                +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:142:17
@@ -527,10 +519,6 @@ LL |     mac2!(0, 1);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variants that aren't matched
-   |
-LL |             if let $e1..=$e2; { todo!() }
-   |             ++                +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:151:17
@@ -545,10 +533,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let ..$e; { todo!() }
-   |             ++           +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:153:17
@@ -563,10 +547,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let ...$e; { todo!() }
-   |             ++            +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:156:17
@@ -581,10 +561,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let ..=$e; { todo!() }
-   |             ++            +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:158:17
@@ -599,10 +575,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let $e..; { todo!() }
-   |             ++           +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:160:17
@@ -617,10 +589,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let $e...; { todo!() }
-   |             ++            +++++++++++
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/recover-range-pats.rs:162:17
@@ -635,10 +603,6 @@ LL |     mac!(0);
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
    = note: the matched value is of type `i32`
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: you might want to use `if let` to ignore the variant that isn't matched
-   |
-LL |             if let $e..=; { todo!() }
-   |             ++            +++++++++++
 
 error: aborting due to 69 previous errors