1
Fork 0

Rollup merge of #133643 - lcnr:merge-candidates, r=compiler-errors

-Znext-solver: modify candidate preference rules

This implements the design proposed in the FCP in #132325 and matches the old solver behavior. I hope the inline comments are all sufficiently clear, I personally think this is a fairly clear improvement over the existing approach using `fn discard_impls_shadowed_by_env`. This fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/96.

This also fixes #133639 which encounters an ICE in negative coherence when evaluating the where-clause. Given the features required to trigger this ICE 🤷

r? ``@compiler-errors``
This commit is contained in:
Jacob Pratt 2024-12-18 21:38:08 -05:00 committed by GitHub
commit 4cd157e6b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 334 additions and 183 deletions

View file

@ -971,7 +971,7 @@ pub struct ParamEnv<'tcx> {
}
impl<'tcx> rustc_type_ir::inherent::ParamEnv<TyCtxt<'tcx>> for ParamEnv<'tcx> {
fn caller_bounds(self) -> impl IntoIterator<Item = ty::Clause<'tcx>> {
fn caller_bounds(self) -> impl inherent::SliceLike<Item = ty::Clause<'tcx>> {
self.caller_bounds()
}
}