Auto merge of #115400 - gurry:issue-115264-ice, r=compiler-errors
Return ident for ExprField and PatField HIR nodes Fixes #115264
This commit is contained in:
commit
88d9b37a15
3 changed files with 38 additions and 2 deletions
|
@ -3729,6 +3729,8 @@ impl<'hir> Node<'hir> {
|
|||
Node::Lifetime(lt) => Some(lt.ident),
|
||||
Node::GenericParam(p) => Some(p.name.ident()),
|
||||
Node::TypeBinding(b) => Some(b.ident),
|
||||
Node::PatField(f) => Some(f.ident),
|
||||
Node::ExprField(f) => Some(f.ident),
|
||||
Node::Param(..)
|
||||
| Node::AnonConst(..)
|
||||
| Node::ConstBlock(..)
|
||||
|
@ -3737,8 +3739,6 @@ impl<'hir> Node<'hir> {
|
|||
| Node::Block(..)
|
||||
| Node::Ctor(..)
|
||||
| Node::Pat(..)
|
||||
| Node::PatField(..)
|
||||
| Node::ExprField(..)
|
||||
| Node::Arm(..)
|
||||
| Node::Local(..)
|
||||
| Node::Crate(..)
|
||||
|
|
17
tests/ui/attributes/issue-115264-expr-field.rs
Normal file
17
tests/ui/attributes/issue-115264-expr-field.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Regression test for issue 115264
|
||||
// Tests that retrieving the ident of the X::foo field
|
||||
// in main() does not cause an ICE
|
||||
|
||||
// check-pass
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct X {
|
||||
foo: i32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = X {
|
||||
#[doc(alias = "StructItem")]
|
||||
foo: 123,
|
||||
};
|
||||
}
|
19
tests/ui/attributes/issue-115264-pat-field.rs
Normal file
19
tests/ui/attributes/issue-115264-pat-field.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Regression test for issue 115264
|
||||
// Tests that retrieving the ident of 'foo' variable in
|
||||
// the pattern inside main() does not cause an ICE
|
||||
|
||||
// check-pass
|
||||
|
||||
struct X {
|
||||
foo: i32,
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main() {
|
||||
let X {
|
||||
#[doc(alias = "StructItem")]
|
||||
foo
|
||||
} = X {
|
||||
foo: 123
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue