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. |
jieyouxu
left a comment
There was a problem hiding this comment.
Thanks, this also LGTM otherwise too, feel free to r=me after PR CI is green.
|
|
||
| // 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.
This change was attempted before and reverted - #107740.
There was a problem hiding this comment.
Huh, we should add a comment to point this out linking to #107740 and why.
There was a problem hiding this comment.
FWIW #132410 changes after_analysis to pass in TyCtxt directly, avoiding the double locking issue.
| // 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.
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.
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