about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-20 00:55:15 +0100
committerGitHub <noreply@github.com>2025-02-20 00:55:15 +0100
commit704a024688d8654c4eb3af5b4a1e86c8cd3df001 (patch)
treed092185e4b0019362b23f9eb191897f4c0636564 /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
parent10ba57516f8f1d1f125bb99003bc4262ba4eee03 (diff)
parent2be26f0fe80ce2bcf25653ad3e4ca7fe9f4d4b26 (diff)
downloadrust-704a024688d8654c4eb3af5b4a1e86c8cd3df001.tar.gz
rust-704a024688d8654c4eb3af5b4a1e86c8cd3df001.zip
Rollup merge of #137269 - dianne:fix-ref-pat-label-span, r=davidtwco
Pattern Migration 2024: properly label `&` patterns whose subpatterns are from macro expansions

See the failing test output in the first commit for an example of what this going wrong looks like. The error/lint diagnostic tries to point to just the `&` or `&mut` of reference patterns when labeling the causes, to make the output clearer (#134394). The trimming there wasn't quite right though: it used the interior of the reference pattern as a cutoff and extended backwards to find where to trim the pattern's span, but this breaks if the `&` and the interior are from different sources. This PR instead trims by starting at the start of the pattern and ending at the final character of the `&` (or `&mut`, `ref`, `ref mut`, or `mut`, depending on what the error/lint is labeling); that way, there's no opportunity for failure from mixing sources.

I'm not 100% happy with this approach, but I'm also not sure what the best practices are as far as hacky `SourceMap` munching goes, so please let me know if something else would be preferred.

Since `SourceMap::span_through_char` can't change the syntax context of the span, I've also removed a call to `Span::with_ctxt` (we care about the edition of the span in question since this is a hard error in Rust 2024). If we want to be extra safe in case that changes, I can re-add it or track error hardness separately in the `rust_2024_migration_desugared_pats` table.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
0 files changed, 0 insertions, 0 deletions