delegation: fix def path hash collision, add per owner disambiguators#153955
delegation: fix def path hash collision, add per owner disambiguators#153955aerooneqq wants to merge 9 commits intorust-lang:mainfrom
Conversation
|
This is all pretty awful. What exactly definitions create collisions like this? Generic parameters? As I understand the small per-node disambiguator tables partially duplicate content from the big table. |
We generate new The difference between delegation and other Maybe we can create our own
From our side yes, when we create generic params, their def path data can be either
Big table which is Internally Given this underlying structure I also didn't want to iterate over all map to find delegation-related key-values, and I also didn't want to expose the possibility of traversal of whole This left me with an option that I implemented in this PR: for each delegation we create additional disambiguator which follows the main one and then stored in |
|
@rustbot ready To get feedback on the comments. |
This comment has been minimized.
This comment has been minimized.
fbb4d60 to
b9ef605
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
|
This PR may be relevant: It solved the collision problem by adding new |
5c0e8e9 to
ef583eb
Compare
|
Some changes occurred in compiler/rustc_sanitizers cc @rcvalle |
This comment has been minimized.
This comment has been minimized.
ef583eb to
5b48d28
Compare
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (99547e4): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @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 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 487.434s -> 490.624s (0.65%) |
|
@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.
delegation: fix def path hash collision, add per owner disambiguators
This comment was marked as outdated.
This comment was marked as outdated.
|
@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.
delegation: fix def path hash collision, add per owner disambiguators
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8888ea1): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking 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. Next, please: If you can, justify the regressions found in this try perf run in writing along with @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.1%, secondary 0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -5.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 490.984s -> 490.081s (-0.18%) |
|
Perf looks ok. |
| } | ||
|
|
||
| #[derive(Debug, Default, Clone)] | ||
| pub struct PerDefDisambiguatorState { |
There was a problem hiding this comment.
| pub struct PerDefDisambiguatorState { | |
| pub struct PerParentDisambiguatorState { |
| tcx: TyCtxt<'hir>, | ||
| resolver: &'a mut R, | ||
| disambiguator: DisambiguatorState, | ||
| owner_disambiguator: PerDefDisambiguatorState, |
There was a problem hiding this comment.
| owner_disambiguator: PerDefDisambiguatorState, | |
| disambiguator: PerDefDisambiguatorState, |
Can keep the old field name here, I think.
| // Information about delegations which is used when handling recursive delegations | ||
| pub delegation_infos: LocalDefIdMap<DelegationInfo>, | ||
|
|
||
| pub per_owner_disambiguators: LocalDefIdMap<PerDefDisambiguatorState>, |
There was a problem hiding this comment.
| pub per_owner_disambiguators: LocalDefIdMap<PerDefDisambiguatorState>, | |
| pub per_parent_disambiguators: LocalDefIdMap<PerDefDisambiguatorState>, |
Still per-parent here.
View all comments
This PR addresses the following delegation issues:
found DefPathHash collision between DefPath#153410 when generating newDefIds for generic parameters bysavingintroducing per owner disambiguators and transferring them to AST -> HIR lowering stageDisambiguatorStates from resolve stage and using them at AST -> HIR loweringNext it fixes the ICE which is connected to usingDUMMY_SPin delegation code, which was found during previous fixFinally, after those fixes the ICE: delegation:DefId::expect_local DefId(..) isn't local#143498 is also fixed, only bugs with propagating synthetic generic params are left.Fixes #153410.
Fixes #143498. Part of #118212.r? @petrochenkov