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),
/// 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.

View File

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

View File

@ -947,9 +947,6 @@ fn report_selection_error(
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);

View File

@ -116,11 +116,9 @@ fn evaluate_obligation_no_overflow(
r,
)
}
OverflowError::ErrorReporting => EvaluationResult::EvaluatedToErr,
OverflowError::Error(_) => EvaluationResult::EvaluatedToErr,
})
}
Err(OverflowError::ErrorReporting) => EvaluationResult::EvaluatedToErr,
Err(OverflowError::Error(_)) => EvaluationResult::EvaluatedToErr,
}
}

View File

@ -14,9 +14,9 @@
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 @@ fn candidate_from_obligation_no_cache<'o>(
}
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 @@ fn evaluate_stack<'o>(
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),
}
}

View File

@ -81,7 +81,6 @@ pub(crate) fn get_blanket_impls(&mut self, item_def_id: DefId) -> Vec<Item> {
match infcx.evaluate_obligation(&obligation) {
Ok(eval_result) if eval_result.may_apply() => {}
Err(traits::OverflowError::Canonical) => {}
Err(traits::OverflowError::ErrorReporting) => {}
_ => continue 'blanket_impls,
}
}