diff options
| author | Tom Farmer <tfarmer7980@gmail.com> | 2021-10-05 18:53:24 +0100 |
|---|---|---|
| committer | Tom Farmer <tfarmer7980@gmail.com> | 2021-10-05 22:43:06 +0100 |
| commit | 0950d5afe227c7097e59bf797a85267d3a659744 (patch) | |
| tree | 9ad18111b8aa5a2521650e284b75a6ba97a80f11 /compiler/rustc_trait_selection/src/traits/select | |
| parent | 25ec8273855fde2d72ae877b397e054de5300e10 (diff) | |
Issue 89275 fix and test
Issue 89275 fix and test Fix librustdoc OverflowError usage rust tidy run Issue 89275 fix and test
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/select')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 719412492f6..277617a5685 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -13,7 +13,7 @@ use rustc_target::spec::abi::Abi; use crate::traits::coherence::Conflict; use crate::traits::{util, SelectionResult}; -use crate::traits::{Overflow, Unimplemented}; +use crate::traits::{ErrorReporting, Overflow, Unimplemented}; use super::BuiltinImplConditions; use super::IntercrateAmbiguityCause; @@ -156,7 +156,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(Some(EvaluatedCandidate { candidate: c, evaluation: eval })) } Ok(_) => Ok(None), - Err(OverflowError) => Err(Overflow), + Err(OverflowError::Cannonical) => Err(Overflow), + Err(OverflowError::ErrorReporting) => Err(ErrorReporting), }) .flat_map(Result::transpose) .collect::<Result<Vec<_>, _>>()?; diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index e191654210a..3818e75a1de 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -20,8 +20,8 @@ use super::ObligationCauseCode; use super::Selection; use super::SelectionResult; use super::TraitQueryMode; +use super::{ErrorReporting, Overflow, SelectionError, Unimplemented}; use super::{ObligationCause, PredicateObligation, TraitObligation}; -use super::{Overflow, SelectionError, Unimplemented}; use crate::infer::{InferCtxt, InferOk, TypeFreshener}; use crate::traits::error_reporting::InferCtxtExt; @@ -900,7 +900,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { match self.candidate_from_obligation(stack) { Ok(Some(c)) => self.evaluate_candidate(stack, &c), Ok(None) => Ok(EvaluatedToAmbig), - Err(Overflow) => Err(OverflowError), + Err(Overflow) => Err(OverflowError::Cannonical), + Err(ErrorReporting) => Err(OverflowError::ErrorReporting), Err(..) => Ok(EvaluatedToErr), } } @@ -1057,10 +1058,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { if !self.infcx.tcx.recursion_limit().value_within_limit(depth) { match self.query_mode { TraitQueryMode::Standard => { + if self.infcx.is_tainted_by_errors() { + return Err(OverflowError::ErrorReporting); + } self.infcx.report_overflow_error(error_obligation, true); } TraitQueryMode::Canonical => { - return Err(OverflowError); + return Err(OverflowError::Cannonical); } } } |
