Skip to content

Commit 42b0201

Browse files
committed
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.)
1 parent f9c15f4 commit 42b0201

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

compiler/rustc_passes/src/check_attr.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_session::lint::builtin::{
3535
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES,
3636
};
3737
use rustc_session::parse::feature_err;
38-
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, edition, sym};
38+
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, edition, kw, sym};
3939
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
4040
use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
4141
use rustc_trait_selection::traits::ObligationCtxt;
@@ -715,7 +715,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
715715
&& !matches!(other_attr.path().as_slice(), [sym::rustfmt, ..])
716716
{
717717
let path = other_attr.path();
718-
let path: Vec<_> = path.iter().map(|s| s.as_str()).collect();
718+
let path: Vec<_> = path
719+
.iter()
720+
.map(|s| if *s == kw::PathRoot { "" } else { s.as_str() })
721+
.collect();
719722
let other_attr_name = path.join("::");
720723

721724
self.dcx().emit_err(errors::NakedFunctionIncompatibleAttribute {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ error[E0736]: attribute incompatible with `#[unsafe(naked)]`
3737
--> $DIR/naked-invalid-attr.rs:56:1
3838
|
3939
LL | #[::a]
40-
| ^^^^^^ the `{{root}}::a` attribute is incompatible with `#[unsafe(naked)]`
40+
| ^^^^^^ the `::a` attribute is incompatible with `#[unsafe(naked)]`
4141
...
4242
LL | #[unsafe(naked)]
4343
| ---------------- function marked with `#[unsafe(naked)]` here

0 commit comments

Comments
 (0)