Bad span in suggestion for unsafe_attr_outside_unsafe in macro expansion with cfg_attr #132908
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-edition-2024
Area: The 2024 edition
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-bug
Category: This is a bug.
D-edition
Diagnostics: An error or lint that should account for edition differences.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
L-unsafe_attr_outside_unsafe
Lint: unsafe_attr_outside_unsafe
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code:
generates a suggestion which when applied looks like:
#[cfg_attr(all(), liunsafe(nk_section = ".text.startup)")]
Somehow the span is off by two bytes on both the start and end.
This doesn't happen outside of a macro expansion, and it seems to also require the cfg_attr.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: