-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit a2c8b0b
Auto merge of #145951 - lcnr:proof-tree-as-query, r=compiler-errors
cleanup and cache proof tree building
There's some cruft left over from when we had deep proof trees. We never encounter overflow when evaluating proof trees. Even if the recursion limit is `0`, we still only hit the overflow limit when evaluating nested goals of the root. The root goal simply inherits the `root_depth` of the `SearchGraph`.
Split `evaluate_root_goal_for_proof_tree` from the rest of the trait solver. This enables us to simplify the implementation of `evaluate_goal_raw` and the `ProofTreeBuilder` as we no longer need to manually track the state of the builder and can instead use separate types for that. It does require making a few internal methods into associated functions taking a `delegate` and a `span` instead of the `EvalCtxt` itself.
I've also split `SearchGraph::evaluate_goal` and `SearchGraph::evaluate_root_goal_for_proof_tree` for the same reason. Both functions don't actually share too much code, so by splitting them each version gets significantly easier to read.
Add a `query evaluate_root_goal_for_proof_tree_raw` to cache proof tree building. This requires arena allocating `inspect::Probe`. I've added a new type alias `I::ProbeRef` for this. We may need to adapt this for rust-analyzer? It would definitely be easy to remove the `Copy` bound here 🤔File tree
15 files changed
+331
-441
lines changed- compiler
- rustc_interface/src
- rustc_middle/src
- query
- ty
- rustc_next_trait_solver/src/solve
- eval_ctxt
- inspect
- rustc_trait_selection/src
- solve/inspect
- rustc_type_ir/src
- search_graph
- solve
15 files changed
+331
-441
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
44 | - | ||
44 | + | ||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
| |||
895 | 895 |
| |
896 | 896 |
| |
897 | 897 |
| |
898 | + | ||
898 | 899 |
| |
899 | 900 |
| |
900 | 901 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
83 | + | ||
83 | 84 |
| |
84 | 85 |
| |
85 | 86 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 | + | ||
9 | 10 |
| |
10 | 11 |
| |
11 | 12 |
| |
| |||
219 | 220 |
| |
220 | 221 |
| |
221 | 222 |
| |
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | ||
222 | 227 |
| |
223 | 228 |
| |
224 | 229 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
131 | 131 |
| |
132 | 132 |
| |
133 | 133 |
| |
134 | - | ||
134 | + | ||
135 | 135 |
| |
136 | 136 |
| |
137 | 137 |
| |
| |||
2563 | 2563 |
| |
2564 | 2564 |
| |
2565 | 2565 |
| |
2566 | + | ||
2567 | + | ||
2568 | + | ||
2569 | + | ||
2570 | + | ||
2571 | + | ||
2572 | + | ||
2573 | + | ||
2566 | 2574 |
| |
2567 | 2575 |
| |
2568 | 2576 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
75 | - | ||
76 | 75 |
| |
77 | - | ||
76 | + | ||
77 | + | ||
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
| |||
737 | 737 |
| |
738 | 738 |
| |
739 | 739 |
| |
740 | + | ||
741 | + | ||
742 | + | ||
743 | + | ||
744 | + | ||
745 | + | ||
746 | + | ||
747 | + | ||
748 | + | ||
749 | + | ||
750 | + | ||
740 | 751 |
| |
741 | 752 |
| |
742 | 753 |
| |
|
Lines changed: 24 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 | - | ||
59 | + | ||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
65 | - | ||
65 | + | ||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 | - | ||
69 | + | ||
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
74 | - | ||
74 | + | ||
75 | + | ||
75 | 76 |
| |
76 | 77 |
| |
77 | 78 |
| |
| |||
271 | 272 |
| |
272 | 273 |
| |
273 | 274 |
| |
274 | - | ||
275 | + | ||
275 | 276 |
| |
276 | 277 |
| |
277 | 278 |
| |
279 | + | ||
278 | 280 |
| |
279 | 281 |
| |
280 | - | ||
282 | + | ||
281 | 283 |
| |
282 | 284 |
| |
283 | - | ||
285 | + | ||
284 | 286 |
| |
285 | 287 |
| |
286 | 288 |
| |
287 | - | ||
289 | + | ||
288 | 290 |
| |
289 | - | ||
290 | - | ||
291 | - | ||
292 | - | ||
293 | - | ||
294 | - | ||
295 | - | ||
291 | + | ||
296 | 292 |
| |
297 | 293 |
| |
298 | 294 |
| |
299 | 295 |
| |
300 | 296 |
| |
301 | 297 |
| |
302 | 298 |
| |
303 | - | ||
304 | - | ||
299 | + | ||
300 | + | ||
305 | 301 |
| |
306 | 302 |
| |
307 | 303 |
| |
| |||
424 | 420 |
| |
425 | 421 |
| |
426 | 422 |
| |
427 | - | ||
423 | + | ||
428 | 424 |
| |
425 | + | ||
429 | 426 |
| |
430 | 427 |
| |
431 | 428 |
| |
432 | - | ||
433 | - | ||
429 | + | ||
430 | + | ||
434 | 431 |
| |
435 | 432 |
| |
436 | 433 |
| |
437 | 434 |
| |
438 | 435 |
| |
439 | - | ||
436 | + | ||
437 | + | ||
438 | + | ||
439 | + | ||
440 | + | ||
440 | 441 |
| |
441 | - | ||
442 | + | ||
442 | 443 |
| |
443 | 444 |
| |
444 | 445 |
| |
| |||
447 | 448 |
| |
448 | 449 |
| |
449 | 450 |
| |
450 | - | ||
451 | + | ||
451 | 452 |
| |
452 | 453 |
| |
453 | 454 |
| |
|
0 commit comments