Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry pred_known_to_hold_modulo_regions with fulfillment if ambiguous #108754

Merged
merged 1 commit into from
Mar 9, 2023
Merged
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
8 changes: 5 additions & 3 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ fn pred_known_to_hold_modulo_regions<'tcx>(
predicate: pred.to_predicate(infcx.tcx),
};

let result = infcx.predicate_must_hold_modulo_regions(&obligation);
let result = infcx.evaluate_obligation_no_overflow(&obligation);
debug!(?result);

if result && has_non_region_infer {
if result.must_apply_modulo_regions() && !has_non_region_infer {
true
} else if result.may_apply() {
// Because of inference "guessing", selection can sometimes claim
// to succeed while the success requires a guess. To ensure
// this function's result remains infallible, we must confirm
Expand All @@ -179,7 +181,7 @@ fn pred_known_to_hold_modulo_regions<'tcx>(
}
}
} else {
result
false
}
}

Expand Down