Make meta-item API compatible with LocalInternedString::get soundness fix

This commit is contained in:
Vadim Petrochenkov
2019-03-17 14:17:47 +03:00
parent 7cf074a1e6
commit db74efce69
17 changed files with 84 additions and 97 deletions

View File

@@ -463,9 +463,10 @@ impl<'a> TraitDef<'a> {
let mut attrs = newitem.attrs.clone();
attrs.extend(item.attrs
.iter()
.filter(|a| a.ident_str().map_or(false, |name| {
["allow", "warn", "deny", "forbid", "stable", "unstable"].contains(&name)
}))
.filter(|a| {
["allow", "warn", "deny", "forbid", "stable", "unstable"]
.contains(&a.name_or_empty().get())
})
.cloned());
push(Annotatable::Item(P(ast::Item { attrs: attrs, ..(*newitem).clone() })))
}