Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fn pred_known_to_hold_modulo_regions<'tcx>(

if result.must_apply_modulo_regions() {
true
} else if result.may_apply() {
} else if result.may_apply() && !infcx.next_trait_solver() {
// Sometimes obligations are ambiguous because the recursive evaluator
// is not smart enough, so we fall back to fulfillment when we're not certain
// that an obligation holds or not. Even still, we must make sure that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use rustc_macros::extension;
use rustc_middle::span_bug;
use rustc_next_trait_solver::solve::{Certainty, GenerateProofTree, SolverDelegateEvalExt};
use rustc_span::DUMMY_SP;

use crate::infer::InferCtxt;
use crate::infer::canonical::OriginalQueryValues;
use crate::traits::{
EvaluationResult, ObligationCtxt, OverflowError, PredicateObligation, SelectionContext,
};
use crate::solve::SolverDelegate;
use crate::traits::{EvaluationResult, OverflowError, PredicateObligation, SelectionContext};

#[extension(pub trait InferCtxtExt<'tcx>)]
impl<'tcx> InferCtxt<'tcx> {
Expand Down Expand Up @@ -69,16 +70,14 @@ impl<'tcx> InferCtxt<'tcx> {

if self.next_trait_solver() {
self.probe(|snapshot| {
let ocx = ObligationCtxt::new(self);
ocx.register_obligation(obligation.clone());
let mut result = EvaluationResult::EvaluatedToOk;
for error in ocx.select_all_or_error() {
if error.is_true_error() {
return Ok(EvaluationResult::EvaluatedToErr);
} else {
result = result.max(EvaluationResult::EvaluatedToAmbig);
}
}
let mut result = match <&SolverDelegate<'tcx>>::from(self)
.evaluate_root_goal(obligation.as_goal(), GenerateProofTree::No, DUMMY_SP)
.0
{
Ok((_, Certainty::Yes)) => EvaluationResult::EvaluatedToOk,
Ok((_, Certainty::Maybe(_))) => EvaluationResult::EvaluatedToAmbig,
Err(_) => EvaluationResult::EvaluatedToErr,
};
if self.opaque_types_added_in_snapshot(snapshot) {
result = result.max(EvaluationResult::EvaluatedToOkModuloOpaqueTypes);
} else if self.region_constraints_added_in_snapshot(snapshot) {
Expand Down
Loading