Commit e6b6fa6
yimiliya
Handle error types gracefully in cat_deref
The issue was that when type resolution fails (e.g., due to combining
unstable features like pin_ergonomics with min_generic_const_args),
`structurally_resolve_type` returns an error type.
When `builtin_deref` is called on this error type, it returns `None`,
causing the code to panic with "explicit deref of non-derefable type".
The fix checks if the resolved type contains an error using
`error_reported_in_ty` and returns early if so, allowing compilation
to continue and report the actual error instead of ICE-ing.1 parent 01bff9e commit e6b6fa6
File tree
2 files changed
+20
-4
lines changed- compiler/rustc_hir_typeck/src
- tests/ui/pin-ergonomics
2 files changed
+20
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1510 | 1510 | | |
1511 | 1511 | | |
1512 | 1512 | | |
1513 | | - | |
| 1513 | + | |
1514 | 1514 | | |
1515 | | - | |
1516 | | - | |
1517 | | - | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
1518 | 1521 | | |
1519 | 1522 | | |
1520 | 1523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments