Unflatten use statements in HIR - #161349
Conversation
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
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 |
…ding scope instead
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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