Skip to content

Commit 2090303

Browse files
committed
Switch DefineOpaqueTypes::No to Yes where the self type can't be an opaque anyway
1 parent 2379e0e commit 2090303

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
899899
return;
900900
}
901901
}
902-
ty::Infer(ty::TyVar(_)) => {
903-
debug!("assemble_candidates_from_object_ty: ambiguous");
904-
candidates.ambiguous = true; // could wind up being an object type
905-
return;
902+
ty::Infer(ty::TyVar(_)) => bug!("assemble_candidates_from_object_ty is already gated behind an infer var check"),
903+
ty::Alias(ty::Opaque, alias) if self.infcx.can_define_opaque_ty(alias.def_id) => {
904+
bug!("assemble_candidates_from_object_ty is already gated behind an opaque type ");
906905
}
907906
_ => return,
908907
};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16881688
});
16891689
self.infcx
16901690
.at(&obligation.cause, obligation.param_env)
1691-
.eq(DefineOpaqueTypes::No, placeholder_trait_ref, trait_bound)
1691+
.eq(DefineOpaqueTypes::Yes, placeholder_trait_ref, trait_bound)
16921692
.map(|InferOk { obligations: _, value: () }| {
16931693
// This method is called within a probe, so we can't have
16941694
// inference variables and placeholders escape.

0 commit comments

Comments
 (0)