Uh oh!
There was an error while loading. Please reload this page.
resolve: no allocation in resolve_ident_in(_local)_module_* - #158604
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Jun 30, 2026
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
resolve: no allocation in `resolve_ident_in(_local)_module_*`
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Jun 30, 2026
Finished benchmarking commit (c6760d2): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.0%, secondary -2.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 6.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 490.57s -> 486.678s (-0.79%) |
Nice perf, however both kinds of asserts fail: letSome(resolution) = self.resolution(module.to_module(), key)else{assert!(finalize.is_some() == !module.has_unexpanded_invocations());returnErr(ControlFlow::Continue(Determinacy::determined(
!module.has_unexpanded_invocations(),)));};and kind 2: ifletSome(finalize) = finalize {assert!(!module.has_unexpanded_invocations());returnself.get_mut().finalize_module_binding(
ident,
orig_ident_span,
binding,
parent_scope,
finalize,
shadowing,);}Kind 1 is a bit fragile, if we are not in In the early return, I noticed that this assertion does not trigger, which seems a bit more logical: // finalize implies no unexpanded invocationsassert!(!finalize.is_some() || !module.has_unexpanded_invocations()); |
petrochenkov
commented
Jun 30, 2026
Then let's do #158604 (comment) to preserve the existing behavior.
That's indeed weird and needs to be investigated, but not necessarily as a part of this PR.
Yeah, "implies" is of course the right condition, not "equals". |
Did this plus the other comments. @rustbot ready
So it was pretty easy to track, when we collect invocations in the expansion algorithm, we enter // ... let vis = self.resolve_visibility(&item.vis);// ...Which uses matchself.r.try_resolve_visibility(&self.parent_scope, vis,true){pub(crate)fn try_resolve_visibility(&mutself,parent_scope:&ParentScope<'ra>,vis:&ast::Visibility,finalize:bool,) -> Result<Visibility,VisResolutionError>{so it seems there are multiple levels of /// Invariant: if `Finalize` is used, expansion and import resolution must be complete.#[derive(Copy,Clone,Debug)]structFinalize{ ... }Should i open an issue? |
petrochenkov
commented
Jun 30, 2026
The current version doesn't mirror |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Jun 30, 2026
The visibility resolution is sort of hacky, it has to produce some definite result very early when nothing is ready, and cannot delay resolution. But due to restrictions on visibility paths it probably works correctly. |
a1f67c3 to
ccd5b9fCompareLorrensP-2158466
commented
Jun 30, 2026
Indeed, i was a bit fast there, oops. @rustbot ready
Alright! |
petrochenkov
commented
Jun 30, 2026
rustbot
commented
Jun 30, 2026
Reminder, once the PR becomes ready for a review, use |
ccd5b9f to
d737d29CompareLorrensP-2158466
commented
Jun 30, 2026
@bors r=petrochenkov |
This comment has been minimized.
This comment has been minimized.
…rochenkov resolve: no allocation in `resolve_ident_in(_local)_module_*` Somewhat of a follow up of #158207 and #158035. Remove the `or_default` call of `NameResolutions` which does an arena allocation. Prep work for parallel import resolution. - cycle detection now works on `module` and `bindingkey` instead of the `NameResolution`. This should have no impact as `NameResolutions` are found by that pair. - Now that we get an `Option<NameResolution>` the logic changed a bit to work with `None`. Did this by following the logic of the functions to see what would happen with a completely empty resolution (`or_default`). r? @petrochenkov
rust-log-analyzer
commented
Jun 30, 2026
The job Click to see the possible cause of the failure (guessed by this bot)Important For more information how to resolve CI failures of this job, visit this link. |
💔 Test for dffa685 failed: CI. Failed job:
|
petrochenkov
commented
Jul 1, 2026
@bors retry |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
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 7c5dac9 (parent) -> e2b71ad (this PR) Test differencesShow 2 test diffs2 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard e2b71ade2db4ea263ab0d561d889f3e3795a500d --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
rust-timer
commented
Jul 1, 2026
Finished benchmarking commit (e2b71ad): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.9%, secondary 3.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%, secondary 2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 488.078s -> 490.049s (0.40%) |
View all comments
Somewhat of a follow up of #158207 and #158035. Remove the
or_defaultcall ofNameResolutionswhich does an arena allocation. Prep work for parallel import resolution.moduleandbindingkeyinstead of theNameResolution. This should have no impact asNameResolutionsare found by that pair.Option<NameResolution>the logic changed a bit to work withNone. Did this by following the logic of the functions to see what would happen with a completely empty resolution (or_default).r? @petrochenkov