fix: lookup upwards for struct and enum
This commit is contained in:
parent
bc8efca0c8
commit
a0c52794bd
2 changed files with 15 additions and 2 deletions
crates
|
@ -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…
Add table
Reference in a new issue