Commit 3d52076
committed
gccrs: avoid ICE on generic const expressions in path resolution
ResolvePathRef::resolve_with_node_id assumed CONST types were always
concrete values and asserted otherwise. Generic const expressions such
as { N + 1 } are symbolic and cannot be evaluated prior to
monomorphization, leading to an internal compiler error.
Reject non-value const kinds gracefully and emit a diagnostic instead
of aborting.
Fixes #4302
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::resolve_with_node_id): Reject non-value
generic const expressions and emit a diagnostic instead of ICE.
gcc/testsuite/ChangeLog:
* rust/compile/const-generic-ice-4302.rs: New test.
Signed-off-by: Jayant Chauhan <0001jayant@gmail.com>1 parent c35ffdb commit 3d52076
File tree
2 files changed
+14
-1
lines changed- gcc
- rust/backend
- testsuite/rust/compile
2 files changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
197 | 204 | | |
198 | 205 | | |
199 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments