-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Driver cleanups #133198
Driver cleanups #133198
Conversation
The `Ok(())` was doing nothing.
Instead of passing in and returning an `AstFragment`. It's a little simpler that way, avoiding the need to return a tuple.
@bors rollup |
The job Click to see the possible cause of the failure (guessed by this bot)
|
I suspect the |
This PR looks fine to me. Just FYI: I've got a whole bunch of driver refactorings myself that may conflict with whatever cleanups you want to do to the driver. Part of them are in #132410 and the rest are in a branch somewhere waiting for this PR to be merged. |
I'm fine with this PR being merged separately. It contains some changes that are not in my PR and it may take a while before my PR gets reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this also LGTM otherwise too, feel free to r=me after PR CI is green.
@@ -424,13 +424,14 @@ fn run_compiler( | |||
} | |||
|
|||
// Make sure name resolution and macro expansion is run. | |||
queries.global_ctxt()?.enter(|tcx| tcx.resolver_for_lowering()); | |||
let mut gcx = queries.global_ctxt()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was attempted before and reverted - #107740.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, we should add a comment to point this out linking to #107740 and why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW #132410 changes after_analysis to pass in TyCtxt directly, avoiding the double locking issue.
let orig_expansion_data = self.cx.current_expansion.clone(); | ||
let orig_force_mode = self.cx.force_mode; | ||
|
||
// Collect all macro invocations and replace them with placeholders. | ||
let (mut fragment_with_placeholders, mut invocations) = | ||
self.collect_invocations(input_fragment, &[]); | ||
let mut invocations = self.collect_invocations(&mut fragment, &[]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming (input_fragment
, fragment_with_placeholders
, expanded_fragment
) was important to me when I (re)wrote this code.
Otherwise it's not clear what is actually happening with the fragment during the mutations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should also leave a comment explaining the difference between these fragment phases?
(Unassigning myself as petrochenkov knows about this part better.) |
Minor improvements I found while looking at this code.
r? @jieyouxu