-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary #128798
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@bors r+ |
Rollup of 7 pull requests Successful merges: - rust-lang#128520 (Skip over args when determining if async-closure's inner coroutine consumes its upvars) - rust-lang#128552 (Emit an error for invalid use of the `#[no_sanitize]` attribute) - rust-lang#128691 (Update `compiler-builtins` to 0.1.117) - rust-lang#128702 (Add -Zmetrics-dir=PATH to save diagnostic metadata to disk) - rust-lang#128797 (Fuchsia Test Runner: enable ffx repository server) - rust-lang#128798 (refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary) - rust-lang#128800 (Add tracking issue to core-pattern-type) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128798 - futile:refactor/mbe-diagnostics, r=petrochenkov refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary Refactor `mbe::diagnostics::failed_to_match_macro()` to not require a full `ExtCtxt`, but only a `&ParseSess`. It hard-required the `ExtCtxt` only for a call to `cx.trace_macros_diag()`, which we move instead to the only call-site of the function. Note: This could be a potential change in observed behavior, because a call to `cx.trace_macros_diag()` now always happens after `failed_to_match_macro()` was called, where before it was only called at the end of the main return path of the function. But since `trace_macros_diag()` "flushes" out any not-yet-reported errors, it should be ok to call it for all paths, since there shouldn't be any on the non-main paths I think. However, I don't know the rest of the codebase well enough to say that with 100% confidence, but `tests/ui` still pass, which gives at least some confidence in the change. Also concretize the return type from `Box<dyn MacResult>` to `(Span, ErrorGuaranteed)`, because this function will _always_ return an error, and never any other kind of result. Was part of rust-lang#128605 and rust-lang#128747, but is a standalone refactoring. r? ``@petrochenkov``
Refactor
mbe::diagnostics::failed_to_match_macro()
to not require a fullExtCtxt
, but only a&ParseSess
. It hard-required theExtCtxt
only for a call tocx.trace_macros_diag()
, which we move instead to the only call-site of the function.Note: This could be a potential change in observed behavior, because a call to
cx.trace_macros_diag()
now always happens afterfailed_to_match_macro()
was called, where before it was only called at the end of the main return path of the function. But sincetrace_macros_diag()
"flushes" out any not-yet-reported errors, it should be ok to call it for all paths, since there shouldn't be any on the non-main paths I think. However, I don't know the rest of the codebase well enough to say that with 100% confidence, buttests/ui
still pass, which gives at least some confidence in the change.Also concretize the return type from
Box<dyn MacResult>
to(Span, ErrorGuaranteed)
, because this function will always return an error, and never any other kind of result.Was part of #128605 and #128747, but is a standalone refactoring.
r? @petrochenkov