Commit 869fd7e
committed
fix: MIR evaluation of sized &T with recursive const fn
Previously, we didn't recurse in Evaluator::create_memory_map() or
Evaluator::patch_addresses() when handling references with a known
size.
This caused problems for hover rendering on const values, which would
build a memory map for evaluated allocations and then pretty-printed
values by following references through that map.
As a result, references in the map still pointed to the original addresses,
meaning that the value pretty-printer would see the type parameters
before substitution. This could cause stack overflows on well-formed
Rust code using recursive const functions.
Add a regression test for hovering on a recursive const fn that
previously caused stack overflow.
Fixes #21503
AI disclosure: I used Codex with GPT 5.4 to investigate the issue and
write the initial version of this commit.1 parent 545134a commit 869fd7e
2 files changed
Lines changed: 70 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2211 | 2211 | | |
2212 | 2212 | | |
2213 | 2213 | | |
2214 | | - | |
2215 | | - | |
2216 | | - | |
2217 | | - | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
2218 | 2218 | | |
2219 | 2219 | | |
2220 | 2220 | | |
| |||
2379 | 2379 | | |
2380 | 2380 | | |
2381 | 2381 | | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
2385 | 2396 | | |
2386 | 2397 | | |
2387 | 2398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11078 | 11078 | | |
11079 | 11079 | | |
11080 | 11080 | | |
| 11081 | + | |
| 11082 | + | |
| 11083 | + | |
| 11084 | + | |
| 11085 | + | |
| 11086 | + | |
| 11087 | + | |
| 11088 | + | |
| 11089 | + | |
| 11090 | + | |
| 11091 | + | |
| 11092 | + | |
| 11093 | + | |
| 11094 | + | |
| 11095 | + | |
| 11096 | + | |
| 11097 | + | |
| 11098 | + | |
| 11099 | + | |
| 11100 | + | |
| 11101 | + | |
| 11102 | + | |
| 11103 | + | |
| 11104 | + | |
| 11105 | + | |
| 11106 | + | |
| 11107 | + | |
| 11108 | + | |
| 11109 | + | |
| 11110 | + | |
| 11111 | + | |
| 11112 | + | |
| 11113 | + | |
| 11114 | + | |
| 11115 | + | |
| 11116 | + | |
| 11117 | + | |
| 11118 | + | |
| 11119 | + | |
| 11120 | + | |
| 11121 | + | |
| 11122 | + | |
| 11123 | + | |
| 11124 | + | |
| 11125 | + | |
| 11126 | + | |
| 11127 | + | |
| 11128 | + | |
| 11129 | + | |
| 11130 | + | |
| 11131 | + | |
| 11132 | + | |
11081 | 11133 | | |
11082 | 11134 | | |
11083 | 11135 | | |
| |||
0 commit comments