Rollup merge of #121545 - gvozdvmozgu:fix-attribute-validation-associated-items, r=fmease

fix attribute validation on associated items in traits

#121537, fixed attribute validation on associated items in traits
This commit is contained in:
León Orell Valerian Liehr 2024-03-16 23:28:47 +01:00 committed by GitHub
commit 79c1e58801
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -1527,6 +1527,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
generics,
body.as_deref(),
);
walk_list!(self, visit_attribute, &item.attrs);
self.visit_fn(kind, item.span, item.id);
}
AssocItemKind::Type(_) => {

View File

@ -0,0 +1,7 @@
trait MyTrait {
#[doc = MyTrait]
//~^ ERROR attribute value must be a literal
fn myfun();
}
fn main() {}

View File

@ -0,0 +1,8 @@
error: attribute value must be a literal
--> $DIR/validation-on-associated-items-issue-121537.rs:2:13
|
LL | #[doc = MyTrait]
| ^^^^^^^
error: aborting due to 1 previous error