Skip to content

Commit 93ca030

Browse files
Use DefiningAnchor::Bind in infer_opaque_definition_from_instantiation
1 parent cade266 commit 93ca030

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,15 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
278278
// HACK This bubble is required for this tests to pass:
279279
// nested-return-type2-tait2.rs
280280
// nested-return-type2-tait3.rs
281-
let infcx =
282-
self.tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).build();
281+
let infcx = self
282+
.tcx
283+
.infer_ctxt()
284+
.with_opaque_type_inference(if self.tcx.trait_solver_next() {
285+
DefiningAnchor::Bind(def_id)
286+
} else {
287+
DefiningAnchor::Bubble
288+
})
289+
.build();
283290
let ocx = ObligationCtxt::new(&infcx);
284291
// Require the hidden type to be well-formed with only the generics of the opaque type.
285292
// Defining use functions may have more bounds than the opaque type, which is ok, as long as the

tests/ui/type-alias-impl-trait/cross_inference.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// revisions: current next
2+
//[next] compile-flags: -Ztrait-solver=next
13
// check-pass
24

35
#![feature(type_alias_impl_trait)]

0 commit comments

Comments
 (0)