about summary refs log tree commit diff
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2022-11-04 16:10:32 +0800
committeryukang <moorekang@gmail.com>2022-11-08 11:17:57 +0800
commit3320879f40034b32ef41f1c515baec5a1262f60d (patch)
treed0a1d1a29fdc5e692d8b62ac0c666b27484a700c
parent465ac26405d32cc1dd73460fa465c9303f40ea43 (diff)
downloadrust-3320879f40034b32ef41f1c515baec5a1262f60d.tar.gz
rust-3320879f40034b32ef41f1c515baec5a1262f60d.zip
code cleanup with err.emit_unless
-rw-r--r--compiler/rustc_hir_typeck/src/expr.rs6
-rw-r--r--compiler/rustc_middle/src/ty/context.rs2
2 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs
index e84734f46cb..43669489e69 100644
--- a/compiler/rustc_hir_typeck/src/expr.rs
+++ b/compiler/rustc_hir_typeck/src/expr.rs
@@ -1096,11 +1096,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
             // If the assignment expression itself is ill-formed, don't
             // bother emitting another error
-            let reported = if lhs_ty.references_error() || rhs_ty.references_error() {
-                err.delay_as_bug()
-            } else {
-                err.emit()
-            };
+            let reported = err.emit_unless(lhs_ty.references_error() || rhs_ty.references_error());
             return self.tcx.ty_error_with_guaranteed(reported);
         }
 
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 4016a93caa8..50eece30112 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -1310,7 +1310,7 @@ impl<'tcx> TyCtxt<'tcx> {
         ty: Ty<'tcx>,
         reported: ErrorGuaranteed,
     ) -> Const<'tcx> {
-        self.mk_const(ty::ConstS { kind: ty::ConstKind::Error(reported), ty })
+        self.mk_const(ty::ConstKind::Error(reported), ty)
     }
 
     /// Like [TyCtxt::ty_error] but for constants.