mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
Merge #10987
10987: fix: respect inner attributes for Structs and Enums r=lnicola a=rainy-me fix: #10980 (the allow/deny issue is not fully resolved though.) Co-authored-by: rainy-me <github@yue.coffee>
This commit is contained in:
@@ -181,8 +181,12 @@ fn allowed(&self, id: AttrDefId, allow_name: &str, recursing: bool) -> bool {
|
||||
AttrDefId::ExternBlockId(id) => Some(id.lookup(self.db.upcast()).container.into()),
|
||||
// These warnings should not explore macro definitions at all
|
||||
AttrDefId::MacroDefId(_) => None,
|
||||
// Will never occur under an enum/struct/union/type alias
|
||||
AttrDefId::AdtId(_) => None,
|
||||
AttrDefId::AdtId(aid) => match aid {
|
||||
AdtId::StructId(sid) => Some(sid.lookup(self.db.upcast()).container.into()),
|
||||
AdtId::EnumId(eid) => Some(eid.lookup(self.db.upcast()).container.into()),
|
||||
// Unions aren't yet supported
|
||||
AdtId::UnionId(_) => None,
|
||||
},
|
||||
AttrDefId::FieldId(_) => None,
|
||||
AttrDefId::EnumVariantId(_) => None,
|
||||
AttrDefId::TypeAliasId(_) => None,
|
||||
|
||||
@@ -332,6 +332,15 @@ fn allow_attributes_crate_attr() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
struct S {
|
||||
fooBar: bool,
|
||||
}
|
||||
|
||||
enum E {
|
||||
fooBar,
|
||||
}
|
||||
|
||||
mod F {
|
||||
fn CheckItWorksWithCrateAttr(BAD_NAME_HI: u8) {}
|
||||
|
||||
Reference in New Issue
Block a user