Inline evaluate_obligation instead of going through the query system#81150
Inline evaluate_obligation instead of going through the query system#81150jyn514 wants to merge 2 commits intorust-lang:masterfrom
evaluate_obligation instead of going through the query system#81150Conversation
|
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
There are several reasons I changed this: - `evaluate_obligation` is only used in one place in `rustc_trait_selection`, and in fact warns you against using it anywhere else. - The implementation in `rustc_traits` was considerably more complicated than necessary, because it didn't have the context available in `rustc_trait_selection`. - It allows moving OverflowError into rustc_trait_selection, making rust-lang#81091 simpler (in particular, it allows holding an `Obligation` in OverflowError, which is only defined in `rustc_infer` and not available in rustc_middle). The only reason to keep the previous behavior is if the cache from the query system made it significantly faster.
8d69194 to
1548e0f
Compare
|
Hmm, I'm not sure why removing caching causes this test to fail: rust/src/test/ui/traits/cycle-cache-err-60010.rs Lines 67 to 70 in 4253153 |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
I suspect that the test failure us due to the removed query canonicalization. |
Yup, I changed it to have the old code and the test passes now. I'm still confused why the cycle test is now failing, though. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
i would expect that caching this query is quite useful, so I am hesitant on landing this. Once CI passes I would start by running perf |
|
☔ The latest upstream changes (presumably #81660) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I don't know how to fix the test suite and it sounds like this won't be very useful. |
There are several reasons I changed this:
evaluate_obligationis only used in one place inrustc_trait_selection, and in fact warns you against using itanywhere else.
The implementation in
I think I just didn't understand how it worked.rustc_traitswas considerably more complicatedthan necessary, because it didn't have the context available in
rustc_trait_selection.Move reporting recursion limit errors outside of the trait system #81091 simpler (in particular,
it allows holding an
Obligationin OverflowError, which is onlydefined in
rustc_inferand not available in rustc_middle).The only reason to keep the previous behavior is if the cache from the
query system made it significantly faster.