about summary refs log tree commit diff
path: root/src/librustc/traits
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2020-01-05 23:00:47 +0000
committervarkor <github@varkor.com>2020-01-05 23:00:47 +0000
commitadb46fd0a49108f08bd0d4b8c95317cfbcbb7941 (patch)
treeb553ad5b460ca34b40c604808f7f894376b55238 /src/librustc/traits
parent760ce94c69ca510d44087291c311296f6d9ccdf5 (diff)
downloadrust-adb46fd0a49108f08bd0d4b8c95317cfbcbb7941.tar.gz
rust-adb46fd0a49108f08bd0d4b8c95317cfbcbb7941.zip
Silence `TooGeneric` error
This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later.
Diffstat (limited to 'src/librustc/traits')
-rw-r--r--src/librustc/traits/error_reporting.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index dbc872a51bf..6ac24196e57 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -12,6 +12,7 @@ use crate::hir::Node;
 use crate::infer::error_reporting::TypeAnnotationNeeded as ErrorCode;
 use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
 use crate::infer::{self, InferCtxt};
+use crate::mir::interpret::ErrorHandled;
 use crate::session::DiagnosticMessageId;
 use crate::ty::error::ExpectedFound;
 use crate::ty::fast_reject;
@@ -1086,6 +1087,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
 
             // already reported in the query
             ConstEvalFailure(err) => {
+                if let ErrorHandled::TooGeneric = err {
+                    // Silence this error, as it can be produced during intermediate steps
+                    // when a constant is not yet able to be evaluated (but will be later).
+                    return;
+                }
                 self.tcx.sess.delay_span_bug(
                     span,
                     &format!("constant in type had an ignored error: {:?}", err),