Consistent with treating Ctor Call as Struct in liveness analysis

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin 2025-04-14 14:29:14 +08:00
parent edfdb9205c
commit 8c8212ef12
No known key found for this signature in database
GPG key ID: 0A0D90BE99CEDEAD
3 changed files with 8 additions and 40 deletions

View file

@ -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)
}