Fix tests/ui/asm/naked-invalid-attr.stderr.

`{{root}}` is supposed to be an internal-only name but it shows up in
the output.

(I'm working towards a more general fix -- a universal "joiner" function
that can be used all over the place -- but I'm not there yet, so let's
fix this one in-place for now.)
This commit is contained in:
Nicholas Nethercote 2025-05-27 14:51:42 +10:00
parent f9c15f40fb
commit 42b02019dc
2 changed files with 6 additions and 3 deletions

View file

@ -35,7 +35,7 @@ use rustc_session::lint::builtin::{
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES,
};
use rustc_session::parse::feature_err;
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, edition, sym};
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, edition, kw, sym};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
use rustc_trait_selection::traits::ObligationCtxt;
@ -715,7 +715,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
&& !matches!(other_attr.path().as_slice(), [sym::rustfmt, ..])
{
let path = other_attr.path();
let path: Vec<_> = path.iter().map(|s| s.as_str()).collect();
let path: Vec<_> = path
.iter()
.map(|s| if *s == kw::PathRoot { "" } else { s.as_str() })
.collect();
let other_attr_name = path.join("::");
self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute {

View file

@ -37,7 +37,7 @@ error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-invalid-attr.rs:56:1
|
LL | #[::a]
| ^^^^^^ the `{{root}}::a` attribute is incompatible with `#[unsafe(naked)]`
| ^^^^^^ the `::a` attribute is incompatible with `#[unsafe(naked)]`
...
LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here