about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-02-07 22:37:32 -0800
committerMichael Goulet <michael@errs.io>2022-02-11 12:45:51 -0800
commit29c2bb51c0b82bed1322a18566fb659c1846d136 (patch)
treef92a08a1beabff825f6180e1f173f27d1ef505f2 /compiler/rustc_const_eval/src
parent8b7b0a0e49cf3e313d0432d1f6e8ce20253fef0a (diff)
downloadrust-29c2bb51c0b82bed1322a18566fb659c1846d136.tar.gz
rust-29c2bb51c0b82bed1322a18566fb659c1846d136.zip
rework borrowck errors so that it's harder to not set tainted
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/eval_queries.rs4
-rw-r--r--compiler/rustc_const_eval/src/interpret/eval_context.rs6
2 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
index 7235b8416ad..df08b541801 100644
--- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
+++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs
@@ -287,8 +287,8 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
             if let Some(error_reported) = tcx.typeck_opt_const_arg(def).tainted_by_errors {
                 return Err(ErrorHandled::Reported(error_reported));
             }
-            if tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors {
-                return Err(ErrorHandled::Reported(ErrorReported {}));
+            if let Some(error_reported) = tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors {
+                return Err(ErrorHandled::Reported(error_reported));
             }
         }
         if !tcx.is_mir_available(def.did) {
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index 00c066a2851..022127de65a 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -516,8 +516,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 if let Some(error_reported) = self.tcx.typeck_opt_const_arg(def).tainted_by_errors {
                     throw_inval!(AlreadyReported(error_reported));
                 }
-                if self.tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors {
-                    throw_inval!(AlreadyReported(rustc_errors::ErrorReported {}));
+                if let Some(error_reported) =
+                    self.tcx.mir_borrowck_opt_const_arg(def).tainted_by_errors
+                {
+                    throw_inval!(AlreadyReported(error_reported));
                 }
             }
         }