1
Fork 0

Rollup merge of #128524 - chenyukang:yukang-fix-127930-invalid-outer-style-sugg, r=cjgillot

Don't suggest turning crate-level attributes into outer style

Fixes #127930
This commit is contained in:
Trevor Gross 2024-08-24 21:03:31 -05:00 committed by GitHub
commit dfe7d5c31e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 70 additions and 53 deletions

View file

@ -2902,6 +2902,17 @@ pub struct AttrItem {
pub tokens: Option<LazyAttrTokenStream>,
}
impl AttrItem {
pub fn is_valid_for_outer_style(&self) -> bool {
self.path == sym::cfg_attr
|| self.path == sym::cfg
|| self.path == sym::forbid
|| self.path == sym::warn
|| self.path == sym::allow
|| self.path == sym::deny
}
}
/// `TraitRef`s appear in impls.
///
/// Resolution maps each `TraitRef`'s `ref_id` to its defining trait; that's all