about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2024-08-07 20:49:05 -0500
committerGitHub <noreply@github.com>2024-08-07 20:49:05 -0500
commitfbbabb9d15142e4f4c80932096ab80e68eb5cbb2 (patch)
treea9e3b2e1e95739d8aa9139500e8502f1d95fc8ed /compiler/rustc_codegen_llvm/src/llvm/ffi.rs
parentf4fe5c835aaa1ba93134e8e58f9398ffe4f1fd0d (diff)
parenta70c9e1f8617aa723f8ead57903b00ff117a89f6 (diff)
downloadrust-fbbabb9d15142e4f4c80932096ab80e68eb5cbb2.tar.gz
rust-fbbabb9d15142e4f4c80932096ab80e68eb5cbb2.zip
Rollup merge of #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 #128605 and #128747, but is a standalone refactoring.

r? ``@petrochenkov``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
0 files changed, 0 insertions, 0 deletions