Introduce trivial WF functions, use it in fast path

This commit is contained in:
Michael Goulet
2025-06-13 18:05:11 +00:00
parent 706f244db5
commit b8ef88517d
5 changed files with 84 additions and 1 deletions

View File

@@ -143,6 +143,16 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
None
}
}
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
let arg = self.shallow_resolve_term(arg);
if arg.is_trivially_wf(self.tcx) {
Some(Certainty::Yes)
} else if arg.is_infer() {
Some(Certainty::AMBIGUOUS)
} else {
None
}
}
_ => None,
}
}