Skip to content

Commit 3320879

Browse files
committed
code cleanup with err.emit_unless
1 parent 465ac26 commit 3320879

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

compiler/rustc_hir_typeck/src/expr.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1096,11 +1096,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10961096

10971097
// If the assignment expression itself is ill-formed, don't
10981098
// bother emitting another error
1099-
let reported = if lhs_ty.references_error() || rhs_ty.references_error() {
1100-
err.delay_as_bug()
1101-
} else {
1102-
err.emit()
1103-
};
1099+
let reported = err.emit_unless(lhs_ty.references_error() || rhs_ty.references_error());
11041100
return self.tcx.ty_error_with_guaranteed(reported);
11051101
}
11061102

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ impl<'tcx> TyCtxt<'tcx> {
13101310
ty: Ty<'tcx>,
13111311
reported: ErrorGuaranteed,
13121312
) -> Const<'tcx> {
1313-
self.mk_const(ty::ConstS { kind: ty::ConstKind::Error(reported), ty })
1313+
self.mk_const(ty::ConstKind::Error(reported), ty)
13141314
}
13151315

13161316
/// Like [TyCtxt::ty_error] but for constants.

0 commit comments

Comments
 (0)