fix GeneratorWitness: Clone check
This commit is contained in:
parent
a5cb3cca5e
commit
c1f1bc6e8f
1 changed files with 15 additions and 10 deletions
|
@ -1958,19 +1958,24 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
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()))
|
|
||||||
},
|
|
||||||
};
|
|
||||||
let resolved = self.infcx.shallow_resolve(ty);
|
|
||||||
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
|
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
|
||||||
break Ambiguous;
|
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));
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue