Unflatten use statements in HIR - #161349
Conversation
|
@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.
Unflatten `use` statements in HIR
This comment has been minimized.
This comment has been minimized.
|
💔 Test for bb18a8a failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
|
The CI failure makes no sense, the only way that assert is reachable is by there being UB somewhere afaict: rust/compiler/rustc_metadata/src/rmeta/decoder.rs Lines 1447 to 1452 in b588ef3 Also I can't reproduce locally 😨 |
|
The backtrace doesn't make sense either: The assert is in And rust/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs Lines 138 to 163 in f7d782a |
probably got inlined. but the assert message says it's in a different line
I freshly rebased, so I assumed it should be fine, very odd |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ding scope instead
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
@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.
Unflatten `use` statements in HIR
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (00e1020): 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 rustc-perf 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 3.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -5.9%, secondary 3.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: 470.08s -> 468.116s (-0.42%) |
The HIR and AST representations of use statements are now mirrored, instead of having the HIR flatten the AST representation and duplicating early parts of nested paths:
used to get flattened in HIR to
which duplicated the
a::bpart several times (and many more if you have more nesting).This alone is fine, it made some parts of the compiler simpler and some parts harder, but it also meant we were generating more items (which are also owners) and had to duplicate resolver information across the flattened items. All that is gone with this PR.
This PR is the minimal version we can land, but there are obvious further avenues for cleanups and improvements. I did some refactorings in rustdoc, but I think the import logic can generally be improved by not handling imports together with other items and instead having them in separate tables.
Similarly clippy can probably benefit from a
check_use_treemethod onLateLintPass, but they often need to track separate information anyway, so it may be better to just always manually recurse.cc @cjgillot
r? @petrochenkov (or reassign)
should unblock #159760
see related discussion on #t-compiler > partial_res_map vs per-owner tables @ 💬
part of rust-lang/goals#620
first commit is from #161299
everything up to 6936535 can land in a separate PR first