Commit 04964d7
committed
Use a fresh
The existing `InferCtxt` may already have in-progress projections
for some of the predicates we may (recursively evaluate). This can
cause us to incorrect produce (and cache!) `EvaluatedToRecur`, leading
us to incorrectly mark a predicate as unimplemented.
We now create a fresh `InferCtxt` for each sub-obligation that we
'speculatively' evaluate. This causes us to miss out on some
legitimate caching opportunities, but ensures that our speculative
evaluation cannot pollute any of the caches from the 'real' `InferCtxt`.
The evaluation can still update *global* caches, but our global caches
don't have any notion of 'in progress', so this is fine.
Fixes #90662InferCtxt when we 'speculatively' evaluate predicates1 parent 1e79d79 commit 04964d7
File tree
2 files changed
+50
-4
lines changed- compiler/rustc_trait_selection/src/traits
- src/test/ui/traits
2 files changed
+50
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
944 | 945 | | |
945 | 946 | | |
946 | 947 | | |
947 | | - | |
948 | | - | |
| 948 | + | |
| 949 | + | |
949 | 950 | | |
950 | 951 | | |
951 | 952 | | |
| |||
957 | 958 | | |
958 | 959 | | |
959 | 960 | | |
960 | | - | |
961 | | - | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
962 | 973 | | |
963 | 974 | | |
| 975 | + | |
964 | 976 | | |
965 | 977 | | |
966 | 978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments