1
Fork 0

Don't select infer -> dyn Trait

This commit is contained in:
Michael Goulet 2023-07-31 15:53:31 +00:00
parent abd3637e42
commit d21a335e8f
3 changed files with 23 additions and 1 deletions

View file

@ -235,7 +235,10 @@ fn rematch_unsize<'tcx>(
goal.param_env,
&mut nested,
);
match (a_ty.kind(), b_ty.kind()) {
// Don't try to coerce `?0` to `dyn Trait`
(ty::Infer(ty::TyVar(_)), _) | (_, ty::Infer(ty::TyVar(_))) => Ok(None),
// Stall any ambiguous upcasting goals, since we can't rematch those
(ty::Dynamic(_, _, ty::Dyn), ty::Dynamic(_, _, ty::Dyn)) => match certainty {
Certainty::Yes => Ok(Some(ImplSource::Builtin(source, nested))),