Rollup merge of #119898 - compiler-errors:error-reporting, r=oli-obk

Remove unused `ErrorReporting` variant from overflow handling

r? oli-obk
This commit is contained in:
Matthias Krüger 2024-01-13 15:10:30 +01:00 committed by GitHub
commit 1037e75d8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 16 deletions

View file

@ -611,9 +611,6 @@ pub enum SelectionError<'tcx> {
NotConstEvaluatable(NotConstEvaluatable), NotConstEvaluatable(NotConstEvaluatable),
/// Exceeded the recursion depth during type projection. /// Exceeded the recursion depth during type projection.
Overflow(OverflowError), 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). /// 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 can thus not know whether the hidden type implements an auto trait, so
/// we should not presume anything about it. /// we should not presume anything about it.

View file

@ -302,7 +302,6 @@ impl EvaluationResult {
pub enum OverflowError { pub enum OverflowError {
Error(ErrorGuaranteed), Error(ErrorGuaranteed),
Canonical, Canonical,
ErrorReporting,
} }
impl From<ErrorGuaranteed> for OverflowError { impl From<ErrorGuaranteed> for OverflowError {
@ -318,7 +317,6 @@ impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
match overflow_error { match overflow_error {
OverflowError::Error(e) => SelectionError::Overflow(OverflowError::Error(e)), OverflowError::Error(e) => SelectionError::Overflow(OverflowError::Error(e)),
OverflowError::Canonical => SelectionError::Overflow(OverflowError::Canonical), OverflowError::Canonical => SelectionError::Overflow(OverflowError::Canonical),
OverflowError::ErrorReporting => SelectionError::ErrorReporting,
} }
} }
} }

View file

@ -947,9 +947,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
Overflow(_) => { Overflow(_) => {
bug!("overflow should be handled before the `report_selection_error` path"); 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); self.note_obligation_cause(&mut err, &obligation);

View file

@ -116,11 +116,9 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
r, r,
) )
} }
OverflowError::ErrorReporting => EvaluationResult::EvaluatedToErr,
OverflowError::Error(_) => EvaluationResult::EvaluatedToErr, OverflowError::Error(_) => EvaluationResult::EvaluatedToErr,
}) })
} }
Err(OverflowError::ErrorReporting) => EvaluationResult::EvaluatedToErr,
Err(OverflowError::Error(_)) => EvaluationResult::EvaluatedToErr, Err(OverflowError::Error(_)) => EvaluationResult::EvaluatedToErr,
} }
} }

View file

@ -14,9 +14,9 @@ use super::util;
use super::util::closure_trait_ref_and_return_type; use super::util::closure_trait_ref_and_return_type;
use super::wf; use super::wf;
use super::{ use super::{
ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation, ObligationCause,
ObligationCause, ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation, ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation, Selection,
Selection, SelectionError, SelectionResult, TraitQueryMode, SelectionError, SelectionResult, TraitQueryMode,
}; };
use crate::infer::{InferCtxt, InferOk, TypeFreshener}; use crate::infer::{InferCtxt, InferOk, TypeFreshener};
@ -496,7 +496,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} }
Ok(_) => Ok(None), Ok(_) => Ok(None),
Err(OverflowError::Canonical) => Err(Overflow(OverflowError::Canonical)), Err(OverflowError::Canonical) => Err(Overflow(OverflowError::Canonical)),
Err(OverflowError::ErrorReporting) => Err(ErrorReporting),
Err(OverflowError::Error(e)) => Err(Overflow(OverflowError::Error(e))), Err(OverflowError::Error(e)) => Err(Overflow(OverflowError::Error(e))),
}) })
.flat_map(Result::transpose) .flat_map(Result::transpose)
@ -1233,7 +1232,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
Ok(Some(c)) => self.evaluate_candidate(stack, &c), Ok(Some(c)) => self.evaluate_candidate(stack, &c),
Ok(None) => Ok(EvaluatedToAmbig), Ok(None) => Ok(EvaluatedToAmbig),
Err(Overflow(OverflowError::Canonical)) => Err(OverflowError::Canonical), Err(Overflow(OverflowError::Canonical)) => Err(OverflowError::Canonical),
Err(ErrorReporting) => Err(OverflowError::ErrorReporting),
Err(..) => Ok(EvaluatedToErr), Err(..) => Ok(EvaluatedToErr),
} }
} }

View file

@ -81,7 +81,6 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
match infcx.evaluate_obligation(&obligation) { match infcx.evaluate_obligation(&obligation) {
Ok(eval_result) if eval_result.may_apply() => {} Ok(eval_result) if eval_result.may_apply() => {}
Err(traits::OverflowError::Canonical) => {} Err(traits::OverflowError::Canonical) => {}
Err(traits::OverflowError::ErrorReporting) => {}
_ => continue 'blanket_impls, _ => continue 'blanket_impls,
} }
} }