save_analysis: fix ice in get_expr_data
This commit is contained in:
parent
826cb062a6
commit
84e4777ae2
@ -534,10 +534,14 @@ pub fn get_expr_data(&self, expr: &hir::Expr<'_>) -> Option<Data> {
|
||||
}
|
||||
}
|
||||
}
|
||||
hir::ExprKind::Struct(hir::QPath::Resolved(_, path), ..) => {
|
||||
hir::ExprKind::Struct(qpath, ..) => {
|
||||
let segment = match qpath {
|
||||
hir::QPath::Resolved(_, path) => path.segments.last().unwrap(),
|
||||
hir::QPath::TypeRelative(_, segment) => segment,
|
||||
};
|
||||
match self.tables.expr_ty_adjusted(&hir_node).kind {
|
||||
ty::Adt(def, _) if !def.is_enum() => {
|
||||
let sub_span = path.segments.last().unwrap().ident.span;
|
||||
let sub_span = segment.ident.span;
|
||||
filter!(self.span_utils, sub_span);
|
||||
let span = self.span_from_span(sub_span);
|
||||
Some(Data::RefData(Ref {
|
||||
@ -580,7 +584,7 @@ pub fn get_expr_data(&self, expr: &hir::Expr<'_>) -> Option<Data> {
|
||||
}
|
||||
_ => {
|
||||
// FIXME
|
||||
bug!();
|
||||
bug!("invalid expression: {:?}", expr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
src/test/ui/save-analysis/issue-73022.rs
Normal file
13
src/test/ui/save-analysis/issue-73022.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// build-pass
|
||||
// compile-flags: -Zsave-analysis
|
||||
enum Enum2 {
|
||||
Variant8 { _field: bool },
|
||||
}
|
||||
|
||||
impl Enum2 {
|
||||
fn new_variant8() -> Enum2 {
|
||||
Self::Variant8 { _field: true }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user