Skip to content

Commit ced0945

Browse files
committed
Switch DefineOpaqueTypes::No to Yes where the self type can't be an opaque anyway
1 parent 6d70858 commit ced0945

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
@@ -894,10 +894,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
894894
return;
895895
}
896896
}
897-
ty::Infer(ty::TyVar(_)) => {
898-
debug!("assemble_candidates_from_object_ty: ambiguous");
899-
candidates.ambiguous = true; // could wind up being an object type
900-
return;
897+
ty::Infer(ty::TyVar(_)) => bug!("assemble_candidates_from_object_ty is already gated behind an infer var check"),
898+
ty::Alias(ty::Opaque, alias) if self.infcx.can_define_opaque_ty(alias.def_id) => {
899+
bug!("assemble_candidates_from_object_ty is already gated behind an opaque type ");
901900
}
902901
_ => return,
903902
};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17191719
});
17201720
self.infcx
17211721
.at(&obligation.cause, obligation.param_env)
1722-
.eq(DefineOpaqueTypes::No, placeholder_trait_ref, trait_bound)
1722+
.eq(DefineOpaqueTypes::Yes, placeholder_trait_ref, trait_bound)
17231723
.map(|InferOk { obligations: _, value: () }| {
17241724
// This method is called within a probe, so we can't have
17251725
// inference variables and placeholders escape.

0 commit comments

Comments
 (0)