Fix error span if arg to `asm!()` is a macro call by gurry · Pull Request #130917 · rust-lang/rust
When the template string passed to asm!() is produced by a macro call like concat!() we were producing wrong error spans. Now in the case of a macro call we just use the entire arg to asm!(), macro call and all, as the error span.
rustbot
added
S-waiting-on-review
labels
Sep 27, 2024
gurry
changed the title
Fix error span if arg to asm!() is a macro call
Fix error span if arg to asm!() is a macro call
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Sep 27, 2024bors added a commit to rust-lang-ci/rust that referenced this pull request
Sep 27, 2024…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#129087 (Stabilize `option_get_or_insert_default`) - rust-lang#130435 (Move Apple linker args from `rustc_target` to `rustc_codegen_ssa`) - rust-lang#130459 (delete sub build directory "debug" to not delete the change-id file) - rust-lang#130873 (rustc_target: Add powerpc64 atomic-related features) - rust-lang#130916 (Use `&raw` in the compiler) - rust-lang#130917 (Fix error span if arg to `asm!()` is a macro call) - rust-lang#130927 (update outdated comments) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Sep 27, 2024Rollup merge of rust-lang#130917 - gurry:129503-ice-wrong-span-in-macros, r=chenyukang Fix error span if arg to `asm!()` is a macro call Fixes rust-lang#129503 When the argument to `asm!()` is a macro call, e.g. `asm!(concat!("abc", "{} pqr"))`, and there's an error in the resulting template string, we do not take into account the presence of this macro call while computing the error span. This PR fixes that. Now we will use the entire thing between the parenthesis of `asm!()` as the error span in this situation e.g. for `asm!(concat!("abc", "{} pqr"))` the error span will be `concat!("abc", "{} pqr")`.
gurry
deleted the
129503-ice-wrong-span-in-macros
branch
gurry
mentioned this pull request
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request
Feb 9, 2026JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request
Feb 9, 2026This 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