Consistent with treating Ctor Call as Struct in liveness analysis
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
parent
edfdb9205c
commit
8c8212ef12
3 changed files with 8 additions and 40 deletions
|
@ -1021,7 +1021,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
}
|
||||
|
||||
hir::ExprKind::Call(ref f, args) => {
|
||||
let succ = self.check_is_ty_uninhabited(expr, succ);
|
||||
let is_ctor = |f: &Expr<'_>| matches!(f.kind, hir::ExprKind::Path(hir::QPath::Resolved(_, path)) if matches!(path.res, rustc_hir::def::Res::Def(rustc_hir::def::DefKind::Ctor(_, _), _)));
|
||||
let succ =
|
||||
if !is_ctor(f) { self.check_is_ty_uninhabited(expr, succ) } else { succ };
|
||||
|
||||
let succ = self.propagate_through_exprs(args, succ);
|
||||
self.propagate_through_expr(f, succ)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue