refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary#128798
Merged
bors merged 1 commit intorust-lang:masterfrom Aug 8, 2024
Merged
refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary#128798bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
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 (
|
Contributor
|
@bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 8, 2024
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
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 8, 2024
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``
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.
Refactor
mbe::diagnostics::failed_to_match_macro()to not require a fullExtCtxt, but only a&ParseSess. It hard-required theExtCtxtonly 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/uistill 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