Skip to content

Commit 38d8317

Browse files
authored
Unrolled build for rust-lang#129062
Rollup merge of rust-lang#129062 - Nadrieril:fix-129009, r=compiler-errors Remove a no-longer-true assert Fixes rust-lang#129009 The assert was simply no longer true. I thought my test suite was thorough but I had not noticed these `let`-specific diagnostics codepaths. r? `@compiler-errors`
2 parents e9c965d + 249a588 commit 38d8317

File tree

5 files changed

+138
-99
lines changed

5 files changed

+138
-99
lines changed

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,12 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
702702
&& adt.is_enum()
703703
&& let Constructor::Variant(variant_index) = witness_1.ctor()
704704
{
705-
let variant = adt.variant(*variant_index);
706-
let inhabited = variant.inhabited_predicate(self.tcx, *adt).instantiate(self.tcx, args);
707-
assert!(inhabited.apply(self.tcx, cx.param_env, cx.module));
708-
!inhabited.apply_ignore_module(self.tcx, cx.param_env)
705+
let variant_inhabited = adt
706+
.variant(*variant_index)
707+
.inhabited_predicate(self.tcx, *adt)
708+
.instantiate(self.tcx, args);
709+
variant_inhabited.apply(self.tcx, cx.param_env, cx.module)
710+
&& !variant_inhabited.apply_ignore_module(self.tcx, cx.param_env)
709711
} else {
710712
false
711713
};

tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr

+22-22
Original file line numberDiff line numberDiff line change
@@ -254,39 +254,39 @@ LL | _ => {}
254254
= note: this pattern matches no values because `!` is uninhabited
255255

256256
error: unreachable pattern
257-
--> $DIR/empty-types.rs:279:9
257+
--> $DIR/empty-types.rs:281:9
258258
|
259259
LL | _ => {}
260260
| ^
261261
|
262262
= note: this pattern matches no values because `!` is uninhabited
263263

264264
error: unreachable pattern
265-
--> $DIR/empty-types.rs:282:9
265+
--> $DIR/empty-types.rs:284:9
266266
|
267267
LL | (_, _) => {}
268268
| ^^^^^^
269269
|
270270
= note: this pattern matches no values because `(!, !)` is uninhabited
271271

272272
error: unreachable pattern
273-
--> $DIR/empty-types.rs:285:9
273+
--> $DIR/empty-types.rs:287:9
274274
|
275275
LL | Ok(_) => {}
276276
| ^^^^^
277277
|
278278
= note: this pattern matches no values because `Result<!, !>` is uninhabited
279279

280280
error: unreachable pattern
281-
--> $DIR/empty-types.rs:286:9
281+
--> $DIR/empty-types.rs:288:9
282282
|
283283
LL | Err(_) => {}
284284
| ^^^^^^
285285
|
286286
= note: this pattern matches no values because `Result<!, !>` is uninhabited
287287

288288
error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
289-
--> $DIR/empty-types.rs:318:11
289+
--> $DIR/empty-types.rs:327:11
290290
|
291291
LL | match slice_never {}
292292
| ^^^^^^^^^^^
@@ -300,7 +300,7 @@ LL + }
300300
|
301301

302302
error[E0004]: non-exhaustive patterns: `&[]` not covered
303-
--> $DIR/empty-types.rs:329:11
303+
--> $DIR/empty-types.rs:338:11
304304
|
305305
LL | match slice_never {
306306
| ^^^^^^^^^^^ pattern `&[]` not covered
@@ -313,7 +313,7 @@ LL + &[] => todo!()
313313
|
314314

315315
error[E0004]: non-exhaustive patterns: `&[]` not covered
316-
--> $DIR/empty-types.rs:343:11
316+
--> $DIR/empty-types.rs:352:11
317317
|
318318
LL | match slice_never {
319319
| ^^^^^^^^^^^ pattern `&[]` not covered
@@ -327,7 +327,7 @@ LL + &[] => todo!()
327327
|
328328

329329
error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
330-
--> $DIR/empty-types.rs:350:11
330+
--> $DIR/empty-types.rs:359:11
331331
|
332332
LL | match *slice_never {}
333333
| ^^^^^^^^^^^^
@@ -341,31 +341,31 @@ LL + }
341341
|
342342

343343
error: unreachable pattern
344-
--> $DIR/empty-types.rs:359:9
344+
--> $DIR/empty-types.rs:368:9
345345
|
346346
LL | _ => {}
347347
| ^
348348
|
349349
= note: this pattern matches no values because `[!; 3]` is uninhabited
350350

351351
error: unreachable pattern
352-
--> $DIR/empty-types.rs:362:9
352+
--> $DIR/empty-types.rs:371:9
353353
|
354354
LL | [_, _, _] => {}
355355
| ^^^^^^^^^
356356
|
357357
= note: this pattern matches no values because `[!; 3]` is uninhabited
358358

359359
error: unreachable pattern
360-
--> $DIR/empty-types.rs:365:9
360+
--> $DIR/empty-types.rs:374:9
361361
|
362362
LL | [_, ..] => {}
363363
| ^^^^^^^
364364
|
365365
= note: this pattern matches no values because `[!; 3]` is uninhabited
366366

367367
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
368-
--> $DIR/empty-types.rs:379:11
368+
--> $DIR/empty-types.rs:388:11
369369
|
370370
LL | match array_0_never {}
371371
| ^^^^^^^^^^^^^
@@ -379,15 +379,15 @@ LL + }
379379
|
380380

381381
error: unreachable pattern
382-
--> $DIR/empty-types.rs:386:9
382+
--> $DIR/empty-types.rs:395:9
383383
|
384384
LL | [] => {}
385385
| -- matches all the values already
386386
LL | _ => {}
387387
| ^ unreachable pattern
388388

389389
error[E0004]: non-exhaustive patterns: `[]` not covered
390-
--> $DIR/empty-types.rs:388:11
390+
--> $DIR/empty-types.rs:397:11
391391
|
392392
LL | match array_0_never {
393393
| ^^^^^^^^^^^^^ pattern `[]` not covered
@@ -401,23 +401,23 @@ LL + [] => todo!()
401401
|
402402

403403
error: unreachable pattern
404-
--> $DIR/empty-types.rs:407:9
404+
--> $DIR/empty-types.rs:416:9
405405
|
406406
LL | Some(_) => {}
407407
| ^^^^^^^
408408
|
409409
= note: this pattern matches no values because `!` is uninhabited
410410

411411
error: unreachable pattern
412-
--> $DIR/empty-types.rs:412:9
412+
--> $DIR/empty-types.rs:421:9
413413
|
414414
LL | Some(_a) => {}
415415
| ^^^^^^^^
416416
|
417417
= note: this pattern matches no values because `!` is uninhabited
418418

419419
error: unreachable pattern
420-
--> $DIR/empty-types.rs:417:9
420+
--> $DIR/empty-types.rs:426:9
421421
|
422422
LL | None => {}
423423
| ---- matches all the values already
@@ -426,7 +426,7 @@ LL | _ => {}
426426
| ^ unreachable pattern
427427

428428
error: unreachable pattern
429-
--> $DIR/empty-types.rs:422:9
429+
--> $DIR/empty-types.rs:431:9
430430
|
431431
LL | None => {}
432432
| ---- matches all the values already
@@ -435,31 +435,31 @@ LL | _a => {}
435435
| ^^ unreachable pattern
436436

437437
error: unreachable pattern
438-
--> $DIR/empty-types.rs:594:9
438+
--> $DIR/empty-types.rs:603:9
439439
|
440440
LL | _ => {}
441441
| ^
442442
|
443443
= note: this pattern matches no values because `!` is uninhabited
444444

445445
error: unreachable pattern
446-
--> $DIR/empty-types.rs:597:9
446+
--> $DIR/empty-types.rs:606:9
447447
|
448448
LL | _x => {}
449449
| ^^
450450
|
451451
= note: this pattern matches no values because `!` is uninhabited
452452

453453
error: unreachable pattern
454-
--> $DIR/empty-types.rs:600:9
454+
--> $DIR/empty-types.rs:609:9
455455
|
456456
LL | _ if false => {}
457457
| ^
458458
|
459459
= note: this pattern matches no values because `!` is uninhabited
460460

461461
error: unreachable pattern
462-
--> $DIR/empty-types.rs:603:9
462+
--> $DIR/empty-types.rs:612:9
463463
|
464464
LL | _x if false => {}
465465
| ^^

0 commit comments

Comments
 (0)