Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4c525d4

Browse files
committedMar 19, 2025
Auto merge of rust-lang#136988 - compiler-errors:impossible_predicates, r=<try>
Use the new solver in the `impossible_predicates` r? lcnr
2 parents a7fc463 + 40269a1 commit 4c525d4

File tree

1 file changed

+5
-9
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+5
-9
lines changed
 

‎compiler/rustc_trait_selection/src/traits/mod.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,11 @@ fn replace_param_and_infer_args_with_placeholder<'tcx>(
701701
/// used during analysis.
702702
pub fn impossible_predicates<'tcx>(tcx: TyCtxt<'tcx>, predicates: Vec<ty::Clause<'tcx>>) -> bool {
703703
debug!("impossible_predicates(predicates={:?})", predicates);
704-
let (infcx, param_env) =
705-
tcx.infer_ctxt().build_with_typing_env(ty::TypingEnv::fully_monomorphized());
704+
let (infcx, param_env) = tcx
705+
.infer_ctxt()
706+
.with_next_trait_solver(true)
707+
.build_with_typing_env(ty::TypingEnv::fully_monomorphized());
708+
706709
let ocx = ObligationCtxt::new(&infcx);
707710
let predicates = ocx.normalize(&ObligationCause::dummy(), param_env, predicates);
708711
for predicate in predicates {
@@ -715,13 +718,6 @@ pub fn impossible_predicates<'tcx>(tcx: TyCtxt<'tcx>, predicates: Vec<ty::Clause
715718
return true;
716719
}
717720

718-
// Leak check for any higher-ranked trait mismatches.
719-
// We only need to do this in the old solver, since the new solver already
720-
// leak-checks.
721-
if !infcx.next_trait_solver() && infcx.leak_check(ty::UniverseIndex::ROOT, None).is_err() {
722-
return true;
723-
}
724-
725721
false
726722
}
727723

0 commit comments

Comments
 (0)
Failed to load comments.