From adb46fd0a49108f08bd0d4b8c95317cfbcbb7941 Mon Sep 17 00:00:00 2001 From: varkor Date: Sun, 5 Jan 2020 23:00:47 +0000 Subject: Silence `TooGeneric` error This error may be produced during intermediate failed attempts at evaluation of a generic const, which may nevertheless succeed later. --- src/librustc/traits/error_reporting.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/librustc') 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), -- cgit 1.4.1-3-g733a5