fix GeneratorWitness: Clone check
This commit is contained in:
parent
a5cb3cca5e
commit
c1f1bc6e8f
@ -1958,18 +1958,23 @@ fn copy_clone_conditions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ty::GeneratorWitness(binder) => {
|
ty::GeneratorWitness(binder) => {
|
||||||
let tys = self.tcx().erase_late_bound_regions(binder);
|
let witness_tys = binder.skip_binder();
|
||||||
let mut iter = tys.iter();
|
let mut iter = witness_tys.iter();
|
||||||
loop {
|
loop {
|
||||||
let ty = match iter.next() {
|
match iter.next() {
|
||||||
Some(ty) => ty,
|
Some(witness_ty) => {
|
||||||
Option::None => {
|
let resolved = self.infcx.shallow_resolve(witness_ty);
|
||||||
break Where(obligation.predicate.rebind(tys.to_vec()))
|
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
|
||||||
|
break Ambiguous;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Option::None => {
|
||||||
|
// (*) binder moved here
|
||||||
|
let all_vars = self.tcx().mk_bound_variable_kinds(
|
||||||
|
obligation.predicate.bound_vars().iter().chain(binder.bound_vars().iter())
|
||||||
|
);
|
||||||
|
break Where(ty::Binder::bind_with_vars(witness_tys.to_vec(), all_vars));
|
||||||
},
|
},
|
||||||
};
|
|
||||||
let resolved = self.infcx.shallow_resolve(ty);
|
|
||||||
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
|
|
||||||
break Ambiguous;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user