File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -196,4 +196,18 @@ fn s() {
196
196
b ! ( 2 ) ;
197
197
}
198
198
199
+ fn t ( ) {
200
+ macro_rules! primitive {
201
+ ( 8 ) => { u8 } ;
202
+ }
203
+
204
+ let foo = & std:: ptr:: null as & ' static dyn std:: ops:: Fn ( ) -> * const primitive ! {
205
+ //~^ WARN irrefutable `let...else` pattern
206
+ 8
207
+ } else {
208
+ // FIXME: right curly brace `}` before `else` in a `let...else` statement not allowed
209
+ return ;
210
+ } ;
211
+ }
212
+
199
213
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -299,5 +299,17 @@ LL | let bad = format_args! {""} else { return; };
299
299
= note: this pattern will always match, so the `else` clause is useless
300
300
= help: consider removing the `else` clause
301
301
302
- error: aborting due to 19 previous errors; 4 warnings emitted
302
+ warning: irrefutable `let...else` pattern
303
+ --> $DIR/bad-let-else-statement.rs:204:5
304
+ |
305
+ LL | / let foo = &std::ptr::null as &'static dyn std::ops::Fn() -> *const primitive! {
306
+ LL | |
307
+ LL | | 8
308
+ LL | | } else {
309
+ | |_____^
310
+ |
311
+ = note: this pattern will always match, so the `else` clause is useless
312
+ = help: consider removing the `else` clause
313
+
314
+ error: aborting due to 19 previous errors; 5 warnings emitted
303
315
You can’t perform that action at this time.
0 commit comments