Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6999acf

Browse files
committedMar 1, 2024
Suggest never pattern instead of _ for empty types
1 parent f5e7dbe commit 6999acf

File tree

6 files changed

+97
-69
lines changed

6 files changed

+97
-69
lines changed
 

‎compiler/rustc_pattern_analysis/src/constructor.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,32 @@ impl<Cx: TypeCx> ConstructorSet<Cx> {
10451045
// In a `MaybeInvalid` place even an empty pattern may be reachable. We therefore
10461046
// add a dummy empty constructor here, which will be ignored if the place is
10471047
// `ValidOnly`.
1048-
missing_empty.push(NonExhaustive);
1048+
missing_empty.push(Never);
10491049
}
10501050
}
10511051

10521052
SplitConstructorSet { present, missing, missing_empty }
10531053
}
1054+
1055+
/// Whether this set only contains empty constructors.
1056+
pub(crate) fn all_empty(&self) -> bool {
1057+
match self {
1058+
ConstructorSet::Bool
1059+
| ConstructorSet::Integers { .. }
1060+
| ConstructorSet::Ref
1061+
| ConstructorSet::Union
1062+
| ConstructorSet::Unlistable => false,
1063+
ConstructorSet::NoConstructors => true,
1064+
ConstructorSet::Struct { empty } => *empty,
1065+
ConstructorSet::Variants { variants, non_exhaustive } => {
1066+
!*non_exhaustive
1067+
&& variants
1068+
.iter()
1069+
.all(|visibility| matches!(visibility, VariantVisibility::Empty))
1070+
}
1071+
ConstructorSet::Slice { array_len, subtype_is_empty } => {
1072+
*subtype_is_empty && matches!(array_len, Some(1..))
1073+
}
1074+
}
1075+
}
10541076
}

‎compiler/rustc_pattern_analysis/src/pat.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,24 @@ impl<Cx: TypeCx> WitnessPat<Cx> {
292292
pub(crate) fn new(ctor: Constructor<Cx>, fields: Vec<Self>, ty: Cx::Ty) -> Self {
293293
Self { ctor, fields, ty }
294294
}
295-
pub(crate) fn wildcard(ty: Cx::Ty) -> Self {
296-
Self::new(Wildcard, Vec::new(), ty)
295+
/// Create a wildcard pattern for this type. If the type is empty, we create a `!` pattern.
296+
pub(crate) fn wildcard(cx: &Cx, ty: Cx::Ty) -> Self {
297+
let is_empty = cx.ctors_for_ty(&ty).is_ok_and(|ctors| ctors.all_empty());
298+
let ctor = if is_empty { Never } else { Wildcard };
299+
Self::new(ctor, Vec::new(), ty)
297300
}
298301

299302
/// Construct a pattern that matches everything that starts with this constructor.
300303
/// For example, if `ctor` is a `Constructor::Variant` for `Option::Some`, we get the pattern
301304
/// `Some(_)`.
302305
pub(crate) fn wild_from_ctor(cx: &Cx, ctor: Constructor<Cx>, ty: Cx::Ty) -> Self {
306+
if matches!(ctor, Wildcard) {
307+
return Self::wildcard(cx, ty);
308+
}
303309
let fields = cx
304310
.ctor_sub_tys(&ctor, &ty)
305311
.filter(|(_, PrivateUninhabitedField(skip))| !skip)
306-
.map(|(ty, _)| Self::wildcard(ty))
312+
.map(|(ty, _)| Self::wildcard(cx, ty))
307313
.collect();
308314
Self::new(ctor, fields, ty)
309315
}

‎tests/ui/pattern/usefulness/empty-types.never_pats.stderr

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ error: unreachable pattern
7474
LL | _ => {}
7575
| ^
7676

77-
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered
77+
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(!)` not covered
7878
--> $DIR/empty-types.rs:91:11
7979
|
8080
LL | match res_u32_never {}
81-
| ^^^^^^^^^^^^^ patterns `Ok(_)` and `Err(_)` not covered
81+
| ^^^^^^^^^^^^^ patterns `Ok(_)` and `Err(!)` not covered
8282
|
8383
note: `Result<u32, !>` defined here
8484
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -92,15 +92,15 @@ note: `Result<u32, !>` defined here
9292
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
9393
|
9494
LL ~ match res_u32_never {
95-
LL + Ok(_) | Err(_) => todo!(),
95+
LL + Ok(_) | Err(!) => todo!(),
9696
LL + }
9797
|
9898

99-
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
99+
error[E0004]: non-exhaustive patterns: `Err(!)` not covered
100100
--> $DIR/empty-types.rs:93:11
101101
|
102102
LL | match res_u32_never {
103-
| ^^^^^^^^^^^^^ pattern `Err(_)` not covered
103+
| ^^^^^^^^^^^^^ pattern `Err(!)` not covered
104104
|
105105
note: `Result<u32, !>` defined here
106106
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -111,7 +111,7 @@ note: `Result<u32, !>` defined here
111111
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
112112
|
113113
LL ~ Ok(_) => {},
114-
LL + Err(_) => todo!()
114+
LL + Err(!) => todo!()
115115
|
116116

117117
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
@@ -136,7 +136,7 @@ error[E0005]: refutable pattern in local binding
136136
--> $DIR/empty-types.rs:106:9
137137
|
138138
LL | let Ok(_x) = res_u32_never;
139-
| ^^^^^^ pattern `Err(_)` not covered
139+
| ^^^^^^ pattern `Err(!)` not covered
140140
|
141141
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
142142
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
@@ -164,7 +164,7 @@ error[E0005]: refutable pattern in local binding
164164
--> $DIR/empty-types.rs:112:9
165165
|
166166
LL | let Ok(_x) = &res_u32_never;
167-
| ^^^^^^ pattern `&Err(_)` not covered
167+
| ^^^^^^ pattern `&Err(!)` not covered
168168
|
169169
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
170170
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
@@ -174,11 +174,11 @@ help: you might want to use `let else` to handle the variant that isn't matched
174174
LL | let Ok(_x) = &res_u32_never else { todo!() };
175175
| ++++++++++++++++
176176

177-
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered
177+
error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered
178178
--> $DIR/empty-types.rs:116:11
179179
|
180180
LL | match result_never {}
181-
| ^^^^^^^^^^^^ patterns `Ok(_)` and `Err(_)` not covered
181+
| ^^^^^^^^^^^^ patterns `Ok(!)` and `Err(!)` not covered
182182
|
183183
note: `Result<!, !>` defined here
184184
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -192,15 +192,15 @@ note: `Result<!, !>` defined here
192192
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
193193
|
194194
LL ~ match result_never {
195-
LL + Ok(_) | Err(_) => todo!(),
195+
LL + Ok(!) | Err(!) => todo!(),
196196
LL + }
197197
|
198198

199-
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
199+
error[E0004]: non-exhaustive patterns: `Err(!)` not covered
200200
--> $DIR/empty-types.rs:121:11
201201
|
202202
LL | match result_never {
203-
| ^^^^^^^^^^^^ pattern `Err(_)` not covered
203+
| ^^^^^^^^^^^^ pattern `Err(!)` not covered
204204
|
205205
note: `Result<!, !>` defined here
206206
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -210,7 +210,7 @@ note: `Result<!, !>` defined here
210210
= note: the matched value is of type `Result<!, !>`
211211
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
212212
|
213-
LL | Ok(_) => {}, Err(_) => todo!()
213+
LL | Ok(_) => {}, Err(!) => todo!()
214214
| +++++++++++++++++++
215215

216216
error: unreachable pattern
@@ -225,11 +225,11 @@ error: unreachable pattern
225225
LL | _ if false => {}
226226
| ^
227227

228-
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
228+
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
229229
--> $DIR/empty-types.rs:146:15
230230
|
231231
LL | match opt_void {
232-
| ^^^^^^^^ pattern `Some(_)` not covered
232+
| ^^^^^^^^ pattern `Some(!)` not covered
233233
|
234234
note: `Option<Void>` defined here
235235
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -240,14 +240,14 @@ note: `Option<Void>` defined here
240240
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
241241
|
242242
LL ~ None => {},
243-
LL + Some(_) => todo!()
243+
LL + Some(!) => todo!()
244244
|
245245

246-
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
246+
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
247247
--> $DIR/empty-types.rs:165:15
248248
|
249249
LL | match *ref_opt_void {
250-
| ^^^^^^^^^^^^^ pattern `Some(_)` not covered
250+
| ^^^^^^^^^^^^^ pattern `Some(!)` not covered
251251
|
252252
note: `Option<Void>` defined here
253253
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -258,7 +258,7 @@ note: `Option<Void>` defined here
258258
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
259259
|
260260
LL ~ None => {},
261-
LL + Some(_) => todo!()
261+
LL + Some(!) => todo!()
262262
|
263263

264264
error: unreachable pattern
@@ -325,11 +325,11 @@ LL + _ => todo!(),
325325
LL ~ }
326326
|
327327

328-
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered
328+
error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered
329329
--> $DIR/empty-types.rs:320:11
330330
|
331331
LL | match *x {}
332-
| ^^ patterns `Ok(_)` and `Err(_)` not covered
332+
| ^^ patterns `Ok(!)` and `Err(!)` not covered
333333
|
334334
note: `Result<!, !>` defined here
335335
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -343,7 +343,7 @@ note: `Result<!, !>` defined here
343343
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
344344
|
345345
LL ~ match *x {
346-
LL + Ok(_) | Err(_) => todo!(),
346+
LL + Ok(!) | Err(!) => todo!(),
347347
LL ~ }
348348
|
349349

@@ -375,44 +375,44 @@ LL + _ => todo!(),
375375
LL + }
376376
|
377377

378-
error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
378+
error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered
379379
--> $DIR/empty-types.rs:329:11
380380
|
381381
LL | match slice_never {
382-
| ^^^^^^^^^^^ pattern `&[_, ..]` not covered
382+
| ^^^^^^^^^^^ pattern `&[!, ..]` not covered
383383
|
384384
= note: the matched value is of type `&[!]`
385385
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
386386
|
387387
LL ~ [] => {},
388-
LL + &[_, ..] => todo!()
388+
LL + &[!, ..] => todo!()
389389
|
390390

391-
error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered
391+
error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered
392392
--> $DIR/empty-types.rs:338:11
393393
|
394394
LL | match slice_never {
395-
| ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered
395+
| ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered
396396
|
397397
= note: the matched value is of type `&[!]`
398398
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
399399
|
400400
LL ~ [_, _, _, ..] => {},
401-
LL + &[] | &[_] | &[_, _] => todo!()
401+
LL + &[] | &[!] | &[!, !] => todo!()
402402
|
403403

404-
error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered
404+
error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered
405405
--> $DIR/empty-types.rs:352:11
406406
|
407407
LL | match slice_never {
408-
| ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered
408+
| ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered
409409
|
410410
= note: the matched value is of type `&[!]`
411411
= note: match arms with guards don't count towards exhaustivity
412412
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
413413
|
414414
LL ~ &[..] if false => {},
415-
LL + &[] | &[_, ..] => todo!()
415+
LL + &[] | &[!, ..] => todo!()
416416
|
417417

418418
error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
@@ -477,11 +477,11 @@ LL ~ [..] if false => {},
477477
LL + [] => todo!()
478478
|
479479

480-
error[E0004]: non-exhaustive patterns: `&Some(_)` not covered
480+
error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
481481
--> $DIR/empty-types.rs:452:11
482482
|
483483
LL | match ref_opt_never {
484-
| ^^^^^^^^^^^^^ pattern `&Some(_)` not covered
484+
| ^^^^^^^^^^^^^ pattern `&Some(!)` not covered
485485
|
486486
note: `Option<!>` defined here
487487
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -492,14 +492,14 @@ note: `Option<!>` defined here
492492
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
493493
|
494494
LL ~ &None => {},
495-
LL + &Some(_) => todo!()
495+
LL + &Some(!) => todo!()
496496
|
497497

498-
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
498+
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
499499
--> $DIR/empty-types.rs:493:11
500500
|
501501
LL | match *ref_opt_never {
502-
| ^^^^^^^^^^^^^^ pattern `Some(_)` not covered
502+
| ^^^^^^^^^^^^^^ pattern `Some(!)` not covered
503503
|
504504
note: `Option<!>` defined here
505505
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -510,14 +510,14 @@ note: `Option<!>` defined here
510510
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
511511
|
512512
LL ~ None => {},
513-
LL + Some(_) => todo!()
513+
LL + Some(!) => todo!()
514514
|
515515

516-
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
516+
error[E0004]: non-exhaustive patterns: `Err(!)` not covered
517517
--> $DIR/empty-types.rs:541:11
518518
|
519519
LL | match *ref_res_never {
520-
| ^^^^^^^^^^^^^^ pattern `Err(_)` not covered
520+
| ^^^^^^^^^^^^^^ pattern `Err(!)` not covered
521521
|
522522
note: `Result<!, !>` defined here
523523
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -528,14 +528,14 @@ note: `Result<!, !>` defined here
528528
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
529529
|
530530
LL ~ Ok(_) => {},
531-
LL + Err(_) => todo!()
531+
LL + Err(!) => todo!()
532532
|
533533

534-
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
534+
error[E0004]: non-exhaustive patterns: `Err(!)` not covered
535535
--> $DIR/empty-types.rs:552:11
536536
|
537537
LL | match *ref_res_never {
538-
| ^^^^^^^^^^^^^^ pattern `Err(_)` not covered
538+
| ^^^^^^^^^^^^^^ pattern `Err(!)` not covered
539539
|
540540
note: `Result<!, !>` defined here
541541
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -546,7 +546,7 @@ note: `Result<!, !>` defined here
546546
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
547547
|
548548
LL ~ Ok(_a) => {},
549-
LL + Err(_) => todo!()
549+
LL + Err(!) => todo!()
550550
|
551551

552552
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
@@ -587,26 +587,26 @@ error: unreachable pattern
587587
LL | _x if false => {}
588588
| ^^
589589

590-
error[E0004]: non-exhaustive patterns: `&_` not covered
590+
error[E0004]: non-exhaustive patterns: `&!` not covered
591591
--> $DIR/empty-types.rs:638:11
592592
|
593593
LL | match ref_never {
594-
| ^^^^^^^^^ pattern `&_` not covered
594+
| ^^^^^^^^^ pattern `&!` not covered
595595
|
596596
= note: the matched value is of type `&!`
597597
= note: references are always considered inhabited
598598
= note: match arms with guards don't count towards exhaustivity
599599
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
600600
|
601601
LL ~ &_a if false => {},
602-
LL + &_ => todo!()
602+
LL + &! => todo!()
603603
|
604604

605-
error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
605+
error[E0004]: non-exhaustive patterns: `Ok(!)` not covered
606606
--> $DIR/empty-types.rs:654:11
607607
|
608608
LL | match *ref_result_never {
609-
| ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered
609+
| ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered
610610
|
611611
note: `Result<!, !>` defined here
612612
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -617,14 +617,14 @@ note: `Result<!, !>` defined here
617617
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
618618
|
619619
LL ~ Err(_) => {},
620-
LL + Ok(_) => todo!()
620+
LL + Ok(!) => todo!()
621621
|
622622

623-
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
623+
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
624624
--> $DIR/empty-types.rs:674:11
625625
|
626626
LL | match *x {
627-
| ^^ pattern `Some(_)` not covered
627+
| ^^ pattern `Some(!)` not covered
628628
|
629629
note: `Option<Result<!, !>>` defined here
630630
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -635,7 +635,7 @@ note: `Option<Result<!, !>>` defined here
635635
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
636636
|
637637
LL ~ None => {},
638-
LL + Some(_) => todo!()
638+
LL + Some(!) => todo!()
639639
|
640640

641641
error: aborting due to 49 previous errors; 1 warning emitted

‎tests/ui/pattern/usefulness/empty-types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn arrays_and_slices(x: NeverBundle) {
338338
match slice_never {
339339
//[normal,min_exh_pats]~^ ERROR `&[]`, `&[_]` and `&[_, _]` not covered
340340
//[exhaustive_patterns]~^^ ERROR `&[]` not covered
341-
//[never_pats]~^^^ ERROR `&[]`, `&[_]` and `&[_, _]` not covered
341+
//[never_pats]~^^^ ERROR `&[]`, `&[!]` and `&[!, !]` not covered
342342
[_, _, _, ..] => {}
343343
}
344344
match slice_never {
@@ -352,7 +352,7 @@ fn arrays_and_slices(x: NeverBundle) {
352352
match slice_never {
353353
//[normal,min_exh_pats]~^ ERROR `&[]` and `&[_, ..]` not covered
354354
//[exhaustive_patterns]~^^ ERROR `&[]` not covered
355-
//[never_pats]~^^^ ERROR `&[]` and `&[_, ..]` not covered
355+
//[never_pats]~^^^ ERROR `&[]` and `&[!, ..]` not covered
356356
&[..] if false => {}
357357
}
358358

@@ -653,7 +653,7 @@ fn guards_and_validity(x: NeverBundle) {
653653
}
654654
match *ref_result_never {
655655
//[normal,min_exh_pats]~^ ERROR `Ok(_)` not covered
656-
//[never_pats]~^^ ERROR `Ok(_)` not covered
656+
//[never_pats]~^^ ERROR `Ok(!)` not covered
657657
// useful, reachable
658658
Ok(_) if false => {}
659659
// useful, reachable
@@ -673,7 +673,7 @@ fn diagnostics_subtlety(x: NeverBundle) {
673673
let x: &Option<Result<!, !>> = &None;
674674
match *x {
675675
//[normal,min_exh_pats]~^ ERROR `Some(_)` not covered
676-
//[never_pats]~^^ ERROR `Some(_)` not covered
676+
//[never_pats]~^^ ERROR `Some(!)` not covered
677677
None => {}
678678
}
679679
}

‎tests/ui/rfcs/rfc-0000-never_patterns/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ fn no_arms_or_guards(x: Void) {
1515
//~^ ERROR a never pattern is always unreachable
1616
None => {}
1717
}
18-
match None::<Void> { //~ ERROR: `Some(_)` not covered
18+
match None::<Void> { //~ ERROR: `Some(!)` not covered
1919
Some(!) if true,
2020
//~^ ERROR guard on a never pattern
2121
None => {}
2222
}
23-
match None::<Void> { //~ ERROR: `Some(_)` not covered
23+
match None::<Void> { //~ ERROR: `Some(!)` not covered
2424
Some(!) if true => {}
2525
//~^ ERROR a never pattern is always unreachable
2626
None => {}

‎tests/ui/rfcs/rfc-0000-never_patterns/check.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ LL | Some(never!()) => {}
3131
| this will never be executed
3232
| help: remove this expression
3333

34-
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
34+
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
3535
--> $DIR/check.rs:18:11
3636
|
3737
LL | match None::<Void> {
38-
| ^^^^^^^^^^^^ pattern `Some(_)` not covered
38+
| ^^^^^^^^^^^^ pattern `Some(!)` not covered
3939
|
4040
note: `Option<Void>` defined here
4141
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -46,14 +46,14 @@ note: `Option<Void>` defined here
4646
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
4747
|
4848
LL ~ None => {},
49-
LL + Some(_) => todo!()
49+
LL + Some(!) => todo!()
5050
|
5151

52-
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
52+
error[E0004]: non-exhaustive patterns: `Some(!)` not covered
5353
--> $DIR/check.rs:23:11
5454
|
5555
LL | match None::<Void> {
56-
| ^^^^^^^^^^^^ pattern `Some(_)` not covered
56+
| ^^^^^^^^^^^^ pattern `Some(!)` not covered
5757
|
5858
note: `Option<Void>` defined here
5959
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -64,7 +64,7 @@ note: `Option<Void>` defined here
6464
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
6565
|
6666
LL ~ None => {},
67-
LL + Some(_) => todo!()
67+
LL + Some(!) => todo!()
6868
|
6969

7070
error: aborting due to 6 previous errors

0 commit comments

Comments
 (0)
Please sign in to comment.