Do not register Self: AutoTrait when confirming auto trait (in old solver)#138249
Do not register Self: AutoTrait when confirming auto trait (in old solver)#138249bors merged 1 commit intorust-lang:masterfrom
Self: AutoTrait when confirming auto trait (in old solver)#138249Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Do not register `Self: AutoTrait` when confirming auto trait Every built-in auto impl for a trait goal like `Ty: Auto` immediately registers another obligation of `Ty: Auto` as one of its nested obligations, leading to us stressing the cycle detection machinery a lot more than we need to. This is because all traits have a `Self: Trait` predicate. To fix this, remove the call to `impl_or_trait_obligations` in `vtable_auto_impl`, since auto traits do not have where clauses. r? lcnr
Self: AutoTrait when confirming auto traitSelf: AutoTrait when confirming auto trait (in old solver)
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (4e748ea): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (primary -2.4%, secondary -2.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 765.603s -> 765.667s (0.01%) |
| assert_eq!(obligation.predicate.polarity(), ty::PredicatePolarity::Positive); | ||
| let trait_ref = | ||
| self.infcx.enter_forall_and_leak_universe(obligation.predicate).trait_ref; | ||
| let trait_obligations = self.impl_or_trait_obligations( |
There was a problem hiding this comment.
To be very clear, this impl_or_trait_obligations returns a single predicate, which is this one here:
rust/compiler/rustc_hir_analysis/src/collect/predicates_of.rs
Lines 43 to 70 in 446649d
Arguably that predicate shouldn't even be in the predicates_of and perhaps should be put into the param_env of traits and trait items... but that seems a lot harder to do.
And we would still need to make sure to add the predicate in when calling methods and stuff.
|
@bors r+ |
|
☀️ Test successful - checks-actions |
|
Post-merge analysis result Test differences
|
|
Finished benchmarking commit (961351c): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (secondary 1.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -2.6%, secondary -3.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 777.662s -> 777.245s (-0.05%) |
Every built-in auto impl for a trait goal like
Ty: Autoimmediately registers another obligation ofTy: Autoas one of its nested obligations, leading to us stressing the cycle detection machinery a lot more than we need to. This is because all traits have aSelf: Traitpredicate.To fix this, remove the call to
impl_or_trait_obligationsinvtable_auto_impl, since auto traits do not have where clauses.r? lcnr