Commit 0d1ac13
yimiliya
Use delayed bug instead of panic in mir_const_qualif for invalid const context
The issue was that `mir_const_qualif` would panic when `const_kind`
returned `None`. This can happen when there are prior errors, such as
attempting to declare a const fn in a trait (which is not allowed).
The fix replaces the `span_bug!` with a `span_delayed_bug` and returns
a default value, allowing compilation to continue and report the actual
error instead of ICE-ing.1 parent 431f257 commit 0d1ac13
File tree
2 files changed
+19
-4
lines changed- compiler/rustc_mir_transform/src
- tests/ui/const-traits
2 files changed
+19
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
370 | 375 | | |
371 | 376 | | |
372 | 377 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments