Visit attributes of trait impl items during AST validation
This commit is contained in:
parent
6b23a7e87f
commit
5ef85bbd7c
3 changed files with 25 additions and 1 deletions
|
@ -1051,6 +1051,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||||
|
|
||||||
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl);
|
walk_list!(this, visit_assoc_item, items, AssocCtxt::Impl);
|
||||||
});
|
});
|
||||||
|
walk_list!(self, visit_attribute, &item.attrs);
|
||||||
return; // Avoid visiting again.
|
return; // Avoid visiting again.
|
||||||
}
|
}
|
||||||
ItemKind::Impl(box Impl {
|
ItemKind::Impl(box Impl {
|
||||||
|
@ -1168,7 +1169,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||||
});
|
});
|
||||||
walk_list!(self, visit_assoc_item, items, AssocCtxt::Trait);
|
walk_list!(self, visit_assoc_item, items, AssocCtxt::Trait);
|
||||||
walk_list!(self, visit_attribute, &item.attrs);
|
walk_list!(self, visit_attribute, &item.attrs);
|
||||||
return;
|
return; // Avoid visiting again
|
||||||
}
|
}
|
||||||
ItemKind::Mod(unsafety, ref mod_kind) => {
|
ItemKind::Mod(unsafety, ref mod_kind) => {
|
||||||
if let Unsafe::Yes(span) = unsafety {
|
if let Unsafe::Yes(span) = unsafety {
|
||||||
|
|
8
src/test/ui/on-unimplemented/issue-104140.rs
Normal file
8
src/test/ui/on-unimplemented/issue-104140.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
|
trait Foo {}
|
||||||
|
|
||||||
|
#[rustc_on_unimplemented] //~ ERROR malformed `rustc_on_unimplemented` attribute input
|
||||||
|
impl Foo for u32 {}
|
||||||
|
|
||||||
|
fn main() {}
|
15
src/test/ui/on-unimplemented/issue-104140.stderr
Normal file
15
src/test/ui/on-unimplemented/issue-104140.stderr
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
error: malformed `rustc_on_unimplemented` attribute input
|
||||||
|
--> $DIR/issue-104140.rs:5:1
|
||||||
|
|
|
||||||
|
LL | #[rustc_on_unimplemented]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
help: the following are the possible correct uses
|
||||||
|
|
|
||||||
|
LL | #[rustc_on_unimplemented = "message"]
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")]
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Reference in a new issue