Clarify what attribute and derive macros look like.
This commit is contained in:
parent
5dea5d7549
commit
4bd415f70a
@ -973,7 +973,8 @@ fn lookup_import_candidates_from_module<FilterFn>(
|
|||||||
) {
|
) {
|
||||||
let desc = match binding.macro_kind() {
|
let desc = match binding.macro_kind() {
|
||||||
Some(MacroKind::Bang) => "a function-like macro".to_string(),
|
Some(MacroKind::Bang) => "a function-like macro".to_string(),
|
||||||
Some(kind) => format!("{} {}", kind.article(), kind.descr_expected()),
|
Some(MacroKind::Attr) => format!("an attribute: `#[{}]`", ident),
|
||||||
|
Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident),
|
||||||
None => {
|
None => {
|
||||||
let res = binding.res();
|
let res = binding.res();
|
||||||
format!("{} {}", res.article(), res.descr())
|
format!("{} {}", res.article(), res.descr())
|
||||||
|
@ -4,7 +4,7 @@ error: cannot find macro `test` in this scope
|
|||||||
LL | concat!(test!());
|
LL | concat!(test!());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= note: `test` is in scope, but it is an attribute
|
= note: `test` is in scope, but it is an attribute: `#[test]`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ error: cannot find macro `test` in this scope
|
|||||||
LL | test!();
|
LL | test!();
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= note: `test` is in scope, but it is an attribute
|
= note: `test` is in scope, but it is an attribute: `#[test]`
|
||||||
|
|
||||||
error: cannot find macro `Copy` in this scope
|
error: cannot find macro `Copy` in this scope
|
||||||
--> $DIR/issue-88206.rs:56:5
|
--> $DIR/issue-88206.rs:56:5
|
||||||
@ -24,7 +24,7 @@ error: cannot find macro `Copy` in this scope
|
|||||||
LL | Copy!();
|
LL | Copy!();
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= note: `Copy` is in scope, but it is a derive macro
|
= note: `Copy` is in scope, but it is a derive macro: `#[derive(Copy)]`
|
||||||
|
|
||||||
error: cannot find macro `Box` in this scope
|
error: cannot find macro `Box` in this scope
|
||||||
--> $DIR/issue-88206.rs:52:5
|
--> $DIR/issue-88206.rs:52:5
|
||||||
|
@ -9,7 +9,7 @@ LL | inline!();
|
|||||||
LL | macro_rules! line {
|
LL | macro_rules! line {
|
||||||
| ----------------- similarly named macro `line` defined here
|
| ----------------- similarly named macro `line` defined here
|
||||||
|
|
|
|
||||||
= note: `inline` is in scope, but it is an attribute
|
= note: `inline` is in scope, but it is an attribute: `#[inline]`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ error: cannot find macro `my_macro_attr` in this scope
|
|||||||
LL | my_macro_attr!();
|
LL | my_macro_attr!();
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `my_macro_attr` is in scope, but it is an attribute
|
= note: `my_macro_attr` is in scope, but it is an attribute: `#[my_macro_attr]`
|
||||||
|
|
||||||
error: cannot find macro `MyTrait` in this scope
|
error: cannot find macro `MyTrait` in this scope
|
||||||
--> $DIR/macro-namespace-reserved-2.rs:33:5
|
--> $DIR/macro-namespace-reserved-2.rs:33:5
|
||||||
@ -102,7 +102,7 @@ error: cannot find macro `MyTrait` in this scope
|
|||||||
LL | MyTrait!();
|
LL | MyTrait!();
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `MyTrait` is in scope, but it is a derive macro
|
= note: `MyTrait` is in scope, but it is a derive macro: `#[derive(MyTrait)]`
|
||||||
|
|
||||||
error: cannot find attribute `my_macro` in this scope
|
error: cannot find attribute `my_macro` in this scope
|
||||||
--> $DIR/macro-namespace-reserved-2.rs:38:3
|
--> $DIR/macro-namespace-reserved-2.rs:38:3
|
||||||
|
Loading…
Reference in New Issue
Block a user