Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ impl<'a> base::Resolver for Resolver<'a> {
if let Res::Def(..) = res {
self.session.span_err(
span,
"expected an inert attribute, found an attribute macro"
&format!("expected an inert attribute, found {} {}",
res.article(), res.descr()),
);
return Ok(InvocationRes::Single(self.dummy_ext(kind)));
}
Expand Down Expand Up @@ -322,7 +323,7 @@ impl<'a> Resolver<'a> {
self.check_stability_and_deprecation(&ext, path);

Ok(if ext.macro_kind() != kind {
let expected = if kind == MacroKind::Attr { "attribute" } else { kind.descr() };
let expected = if kind == MacroKind::Attr { "attribute" } else { kind.descr() };
let msg = format!("expected {}, found {} `{}`", expected, res.descr(), path);
self.session.struct_span_err(path.span, &msg)
.span_label(path.span, format!("not {} {}", kind.article(), expected))
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-49934-errors.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fn foo<#[derive(Debug)] T>() {
//~^ ERROR `derive` may only be applied to structs, enums and unions
//~| ERROR expected an inert attribute, found an attribute macro
//~| ERROR expected an inert attribute, found a derive macro
match 0 {
#[derive(Debug)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
//~| ERROR expected an inert attribute, found an attribute macro
//~| ERROR expected an inert attribute, found a derive macro
_ => (),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-49934-errors.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `derive` may only be applied to structs, enums and unions
LL | fn foo<#[derive(Debug)] T>() {
| ^^^^^^^^^^^^^^^^

error: expected an inert attribute, found an attribute macro
error: expected an inert attribute, found a derive macro
--> $DIR/issue-49934-errors.rs:1:17
|
LL | fn foo<#[derive(Debug)] T>() {
Expand All @@ -16,7 +16,7 @@ error: `derive` may only be applied to structs, enums and unions
LL | #[derive(Debug)]
| ^^^^^^^^^^^^^^^^

error: expected an inert attribute, found an attribute macro
error: expected an inert attribute, found a derive macro
--> $DIR/issue-49934-errors.rs:5:18
|
LL | #[derive(Debug)]
Expand Down