mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00: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:
commit
0eb6039e4e
2 changed files with 15 additions and 2 deletions
|
@ -181,8 +181,12 @@ impl<'a> DeclValidator<'a> {
|
|||
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 main() {
|
|||
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) {}
|
||||
|
|
Loading…
Reference in a new issue