diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index fa37466d4d5c..47194e874c66 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -135,23 +135,23 @@ pub fn suggestions( if self.word { debug_assert!(macro_call.is_empty(), "Macro suggestions use list style"); - suggestions.push(format!("{maybe_unsafe_start}{start}{name}{end}{maybe_unsafe_end}")); + suggestions.push(format!("{start}{maybe_unsafe_start}{name}{maybe_unsafe_end}{end}")); } if let Some(descr) = self.list { for descr in descr { suggestions.push(format!( - "{maybe_unsafe_start}{start}{name}{macro_call}({descr}){end}{maybe_unsafe_end}" + "{start}{maybe_unsafe_start}{name}{macro_call}({descr}){maybe_unsafe_end}{end}" )); } } suggestions.extend(self.one_of.iter().map(|&word| { - format!("{maybe_unsafe_start}{start}{name}({word}){end}{maybe_unsafe_end}") + format!("{start}{maybe_unsafe_start}{name}({word}){maybe_unsafe_end}{end}") })); if let Some(descr) = self.name_value_str { debug_assert!(macro_call.is_empty(), "Macro suggestions use list style"); for descr in descr { suggestions.push(format!( - "{maybe_unsafe_start}{start}{name} = \"{descr}\"{end}{maybe_unsafe_end}" + "{start}{maybe_unsafe_start}{name} = \"{descr}\"{maybe_unsafe_end}{end}" )); } } diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 784cbb38aaed..4c9673bf8056 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -159,9 +159,8 @@ LL | #[unsafe(export_name)] | help: must be of the form | -LL - #[unsafe(export_name)] -LL + #[export_name = "name"] - | +LL | #[unsafe(export_name = "name")] + | ++++++++ error: `rustc_allow_const_fn_unstable` expects a list of feature names --> $DIR/malformed-attrs.rs:31:1 @@ -330,7 +329,7 @@ LL | #[unsafe(naked())] help: must be of the form | LL - #[unsafe(naked())] -LL + #[naked] +LL + #[unsafe(naked)] | error[E0565]: malformed `track_caller` attribute input @@ -651,7 +650,7 @@ LL | #[unsafe(ffi_pure = 1)] help: must be of the form | LL - #[unsafe(ffi_pure = 1)] -LL + #[ffi_pure] +LL + #[unsafe(ffi_pure)] | error[E0539]: malformed `link_ordinal` attribute input @@ -677,7 +676,7 @@ LL | #[unsafe(ffi_const = 1)] help: must be of the form | LL - #[unsafe(ffi_const = 1)] -LL + #[ffi_const] +LL + #[unsafe(ffi_const)] | error[E0539]: malformed `linkage` attribute input