From 322694ed56461d36c05673a2644cbd4a44db5259 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 12 Jan 2024 16:48:02 +0000 Subject: [PATCH] Remove unused ErrorReporting variant from overflow handling --- compiler/rustc_middle/src/traits/mod.rs | 3 --- compiler/rustc_middle/src/traits/select.rs | 2 -- .../src/traits/error_reporting/type_err_ctxt_ext.rs | 3 --- .../src/traits/query/evaluate_obligation.rs | 2 -- compiler/rustc_trait_selection/src/traits/select/mod.rs | 8 +++----- src/librustdoc/clean/blanket_impl.rs | 1 - 6 files changed, 3 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index af601a0d702ed..bebee8df10e86 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -611,9 +611,6 @@ pub enum SelectionError<'tcx> { NotConstEvaluatable(NotConstEvaluatable), /// Exceeded the recursion depth during type projection. Overflow(OverflowError), - /// Signaling that an error has already been emitted, to avoid - /// multiple errors being shown. - ErrorReporting, /// Computing an opaque type's hidden type caused an error (e.g. a cycle error). /// We can thus not know whether the hidden type implements an auto trait, so /// we should not presume anything about it. diff --git a/compiler/rustc_middle/src/traits/select.rs b/compiler/rustc_middle/src/traits/select.rs index 734c2b61c07fc..64f4af08e12ed 100644 --- a/compiler/rustc_middle/src/traits/select.rs +++ b/compiler/rustc_middle/src/traits/select.rs @@ -302,7 +302,6 @@ impl EvaluationResult { pub enum OverflowError { Error(ErrorGuaranteed), Canonical, - ErrorReporting, } impl From for OverflowError { @@ -318,7 +317,6 @@ impl<'tcx> From for SelectionError<'tcx> { match overflow_error { OverflowError::Error(e) => SelectionError::Overflow(OverflowError::Error(e)), OverflowError::Canonical => SelectionError::Overflow(OverflowError::Canonical), - OverflowError::ErrorReporting => SelectionError::ErrorReporting, } } } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 47a700805fa5c..e33414aa587a6 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -947,9 +947,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { Overflow(_) => { bug!("overflow should be handled before the `report_selection_error` path"); } - SelectionError::ErrorReporting => { - bug!("ErrorReporting Overflow should not reach `report_selection_err` call") - } }; self.note_obligation_cause(&mut err, &obligation); diff --git a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs index 31e34096fb003..4c0c57377e02a 100644 --- a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs +++ b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs @@ -116,11 +116,9 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { r, ) } - OverflowError::ErrorReporting => EvaluationResult::EvaluatedToErr, OverflowError::Error(_) => EvaluationResult::EvaluatedToErr, }) } - Err(OverflowError::ErrorReporting) => EvaluationResult::EvaluatedToErr, Err(OverflowError::Error(_)) => EvaluationResult::EvaluatedToErr, } } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 61fe2c8efe364..6a6adcbb680ea 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -14,9 +14,9 @@ use super::util; use super::util::closure_trait_ref_and_return_type; use super::wf; use super::{ - ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation, - ObligationCause, ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation, - Selection, SelectionError, SelectionResult, TraitQueryMode, + ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation, ObligationCause, + ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation, Selection, + SelectionError, SelectionResult, TraitQueryMode, }; use crate::infer::{InferCtxt, InferOk, TypeFreshener}; @@ -496,7 +496,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } Ok(_) => Ok(None), Err(OverflowError::Canonical) => Err(Overflow(OverflowError::Canonical)), - Err(OverflowError::ErrorReporting) => Err(ErrorReporting), Err(OverflowError::Error(e)) => Err(Overflow(OverflowError::Error(e))), }) .flat_map(Result::transpose) @@ -1233,7 +1232,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(Some(c)) => self.evaluate_candidate(stack, &c), Ok(None) => Ok(EvaluatedToAmbig), Err(Overflow(OverflowError::Canonical)) => Err(OverflowError::Canonical), - Err(ErrorReporting) => Err(OverflowError::ErrorReporting), Err(..) => Ok(EvaluatedToErr), } } diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 4da85885d67cf..47cfe651e319d 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -81,7 +81,6 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { match infcx.evaluate_obligation(&obligation) { Ok(eval_result) if eval_result.may_apply() => {} Err(traits::OverflowError::Canonical) => {} - Err(traits::OverflowError::ErrorReporting) => {} _ => continue 'blanket_impls, } }