1
Fork 0

Mark some once-again-unreachable paths as unreachable.

This undoes the changes from #121482 and #121586, now that stashed errors
will trigger more early aborts.
This commit is contained in:
Nicholas Nethercote 2024-02-27 15:02:54 +11:00
parent 260ae70140
commit b4e9f93eb4
2 changed files with 6 additions and 13 deletions

View file

@ -988,10 +988,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
if let hir::ExprKind::Struct(qpath, fields, ref base) = expr.kind {
let res = self.typeck_results().qpath_res(qpath, expr.hir_id);
let Some(adt) = self.typeck_results().expr_ty(expr).ty_adt_def() else {
self.tcx.dcx().span_delayed_bug(expr.span, "no adt_def for expression");
return;
};
let adt = self.typeck_results().expr_ty(expr).ty_adt_def().unwrap();
let variant = adt.variant_of_res(res);
if let Some(base) = *base {
// If the expression uses FRU we need to make sure all the unmentioned fields