1
Fork 0

Rollup merge of #112122 - compiler-errors:next-coherence, r=lcnr

Add `-Ztrait-solver=next-coherence`

Flag that conditionally uses the trait solver *only* during coherence, for more testing and/or eventual partial-migration onto the trait solver (in the medium- to long-term).

* This still uses the selection context in some of the coherence methods I think, so it's not "complete". Putting this up for review and/or for further work in-tree.
* I probably need to spend a bit more time making sure that we don't sneakily create any other infcx's during coherence that also need the new solver enabled.

r? `@lcnr`
This commit is contained in:
Dylan DPC 2023-06-07 18:01:29 +05:30 committed by GitHub
commit 0b002eb906
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 142 additions and 63 deletions

View file

@ -285,7 +285,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
let infcx = self
.tcx
.infer_ctxt()
.with_opaque_type_inference(if self.tcx.trait_solver_next() {
.with_opaque_type_inference(if self.next_trait_solver() {
DefiningAnchor::Bind(def_id)
} else {
DefiningAnchor::Bubble

View file

@ -188,7 +188,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
// FIXME(-Ztrait-solver=next): A bit dubious that we're only registering
// predefined opaques in the typeck root.
if infcx.tcx.trait_solver_next() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
if infcx.next_trait_solver() && !infcx.tcx.is_typeck_child(body.source.def_id()) {
checker.register_predefined_opaques_in_new_solver();
}