-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove global next_disambiguator
state and handle it with a DisambiguatorState
type
#140453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
|
||
impl DisambiguatorState { | ||
pub fn new() -> Self { | ||
Self { next: Default::default() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[derive(Default)]
can be used instead of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do prefer new
if Default
isn't needed though.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Remove global `next_disambiguator` state and handle it with a `DisambiguatorState` type This removes `Definitions.next_disambiguator` as it doesn't guarantee deterministic def paths when `create_def` is called in parallel. Instead a new `DisambiguatorState` type is passed as a mutable reference to `create_def` to help create unique def paths. `create_def` calls with distinct `DisambiguatorState` instances must ensure that that the def paths are unique without its help. Anon associated types did rely on this global state for uniqueness and are changed to use (method they're defined in + their position in the method return type) as the `DefPathData` to ensure uniqueness. This also means that the method they're defined in appears in error messages, which is nicer. `DefPathData::NestedStatic` is added to use for nested data inside statics instead of reusing `DefPathData::AnonConst` to avoid conflicts with those. cc `@oli-obk`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (1febaad): comparison URL. Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 0.2%, secondary 1.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.
CyclesResults (primary -0.3%)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: 770.413s -> 770.195s (-0.03%) |
@bors r+ |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 0eb0b8c (parent) -> 243c5a3 (this PR) Test differencesShow 20 test diffs20 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 243c5a35e18b2634892fe7091d5ee888a18f77f5 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (243c5a3): 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 (primary 0.7%, secondary -2.5%)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 0.2%, secondary 2.2%)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: 768.8s -> 770.492s (0.22%) |
Looks like my assumption in I'm not quite sure what the purpose of the remapped lifetime def paths are, but perhaps these should be synthetic to avoid conflicts as they do look like some form of desugaring. cc @cjgillot Another fix could be to pass on |
why would it be cloned? But yea, just giving them a unique |
This removes
Definitions.next_disambiguator
as it doesn't guarantee deterministic def paths whencreate_def
is called in parallel. Instead a newDisambiguatorState
type is passed as a mutable reference tocreate_def
to help create unique def paths.create_def
calls with distinctDisambiguatorState
instances must ensure that that the def paths are unique without its help.Anon associated types did rely on this global state for uniqueness and are changed to use (method they're defined in + their position in the method return type) as the
DefPathData
to ensure uniqueness. This also means that the method they're defined in appears in error messages, which is nicer.DefPathData::NestedStatic
is added to use for nested data inside statics instead of reusingDefPathData::AnonConst
to avoid conflicts with those.cc @oli-obk