Repository navigation
Commit a9ddedf
authored
Rollup merge of #162937 - khyperia:gca-fix-unreachable, r=BoxyUwU
do generic_const_args Const::Ty hack only on projection consts
Under `generic_const_args`, we currently do a bit of a hack to lower all consts to `Const::Ty`, because under `generic_const_args`, projection consts not marked with `#[rustc_always_gca]` could be `impl`'d by a const with a `gca!` rhs, and `Const::Unevaluated` does not support direct consts.
Instead, only lower a const to `Const::Ty` if:
- it is a direct const (under `min_generic_const_args`), OR
- it is a projection const (under `generic_const_args`)
This excludes all anon consts, and regular (not direct) free and inherent consts from being lowered as `Const::Ty` under full GCA. It does not fix the underlying issue that lowering a potentially regular projection const to `Const::Ty` is incorrect.
Fixes #162923
Introduced in #162760
r? @BoxyUwU2 files changed
Lines changed: 43 additions & 20 deletions
File tree
- compiler/rustc_mir_build/src/builder/expr
- tests/ui/const-generics/gca
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
95 | 83 | | |
96 | | - | |
97 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
98 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
99 | 112 | | |
100 | 113 | | |
101 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments