Skip to content

Commit f6a5b29

Browse files
committed
resolve: Tweak some expected/found wording
1 parent ca3766e commit f6a5b29

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/librustc_resolve/macros.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ impl<'a> base::Resolver for Resolver<'a> {
237237
if let Res::Def(..) = res {
238238
self.session.span_err(
239239
span,
240-
"expected an inert attribute, found an attribute macro"
240+
&format!("expected an inert attribute, found {} {}",
241+
res.article(), res.descr()),
241242
);
242243
return Ok(InvocationRes::Single(self.dummy_ext(kind)));
243244
}
@@ -322,7 +323,7 @@ impl<'a> Resolver<'a> {
322323
self.check_stability_and_deprecation(&ext, path);
323324

324325
Ok(if ext.macro_kind() != kind {
325-
let expected = if kind == MacroKind::Attr { "attribute" } else { kind.descr() };
326+
let expected = if kind == MacroKind::Attr { "attribute" } else { kind.descr() };
326327
let msg = format!("expected {}, found {} `{}`", expected, res.descr(), path);
327328
self.session.struct_span_err(path.span, &msg)
328329
.span_label(path.span, format!("not {} {}", kind.article(), expected))

src/test/ui/issues/issue-49934-errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
fn foo<#[derive(Debug)] T>() {
22
//~^ ERROR `derive` may only be applied to structs, enums and unions
3-
//~| ERROR expected an inert attribute, found an attribute macro
3+
//~| ERROR expected an inert attribute, found a derive macro
44
match 0 {
55
#[derive(Debug)]
66
//~^ ERROR `derive` may only be applied to structs, enums and unions
7-
//~| ERROR expected an inert attribute, found an attribute macro
7+
//~| ERROR expected an inert attribute, found a derive macro
88
_ => (),
99
}
1010
}

src/test/ui/issues/issue-49934-errors.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: `derive` may only be applied to structs, enums and unions
44
LL | fn foo<#[derive(Debug)] T>() {
55
| ^^^^^^^^^^^^^^^^
66

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

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

0 commit comments

Comments
 (0)