Load modules during CfgStrip phase#3871
Merged
Merged
Conversation
TopLevel would ignore just-loaded modules but Early and ExpandVisitor wouldn't. The latter would produce errors when it hit attributes which should have been indirectly CfgStrip'd away. gcc/rust/ChangeLog: * expand/rust-cfg-strip.cc (CfgStrip::visit): Load unloaded modules. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Assume modules have been loaded by CfgStrip. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
CohenArthur
requested changes
Jul 7, 2025
CohenArthur
left a comment
Member
There was a problem hiding this comment.
I think this causes issues with modules being loaded when they should be cfg-stripped, e.g
#[cfg(target_arch = "not_my_stuff")]
mod foo;when running the compiler on core with this change, we error out much earlier than without, and on a module specifically for the x86 arch.
Member
|
nevermind my comment - the order just changed and I'm hitting the same error now that I'm progressing on name resolution. so I think this change is probably fine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TopLevelwould ignore just-loaded modules butEarlyandExpandVisitorwouldn't. The latter would produce errors when it hit attributes which should have been indirectlyCfgStrip'd away.