[PERF] allow region unification to change region universes#108867
[PERF] allow region unification to change region universes#108867aliemjay wants to merge 4 commits intorust-lang:masterfrom
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
|
⌛ Trying commit 4cb44a7 with merge 1bced552f1758b8f979780b55c326f0a39c51181... |
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (1bced552f1758b8f979780b55c326f0a39c51181): comparison URL. Overall result: ❌✅ regressions and improvements - 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
There was a problem hiding this comment.
unhappy to have the universe both in the var_infos and in the inference data. I don't think we should error eagerly for universe errors when equating universes because the new solver erases the universe of regions in the argument. THis makes adding universe to the UnifiedRegion really cumbersome I think. It's different for https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/type_variable/enum.TypeVariableValue.html and consts.
Unless you now prefer this approach, I would go ahead with #108121. Thank you for actually looking into my suggestion even though you disagreed ❤️
| pub struct UnifiedRegion<'tcx> { | ||
| pub universe: ty::UniverseIndex, | ||
| pub value: Option<ty::Region<'tcx>>, | ||
| } |
There was a problem hiding this comment.
similar to TypeVariableValue and ConstVariableValue change this to an enum and only have a universe in the Unknown case? 🤔
There was a problem hiding this comment.
although it seems redundant, but I thought it might be a good idea to store the universe of universals and existentials in the same place.
There was a problem hiding this comment.
if region unification is infallible i think we even have to keep the universe even if value is Some, don't we? 🤔
There was a problem hiding this comment.
I don't think so. universe field here is redundant if value is Some.
| (None, None) => *value1, | ||
| }) | ||
| fn unify_values(value1: &Self, value2: &Self) -> Result<Self, Self::Error> { | ||
| Ok(cmp::min_by_key(*value1, *value2, |val| (val.universe, val.value.is_none()))) |
There was a problem hiding this comment.
this can pull down the universe of known regions which seems wrong 🤔 I would expect us to have to eagerly error here if we relate with a known region
There was a problem hiding this comment.
The idea is that unification should always be infallible, the constraint graph will eventually emit a universe error in this case.
The only invariant we should maintain in the unification table is that an existential cannot resolve to a region in a higher universe (plus one nice thing to have is to prefer universals over existentials within the same universe, but that's not necessary for soundness).
|
@craterbot run mode=check-only |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
|
|
closing this as it was a perf experiment |
forked from #108121.
r? @ghost