minor fixups as per PR feedback
This commit is contained in:
parent
543023c249
commit
62112f4dc1
2 changed files with 17 additions and 32 deletions
|
@ -537,10 +537,8 @@ impl<'tcx> CloneShimBuilder<'tcx> {
|
||||||
let variant_index = VariantIdx::new(index);
|
let variant_index = VariantIdx::new(index);
|
||||||
let dest = self.tcx.mk_place_downcast_unnamed(dest, variant_index);
|
let dest = self.tcx.mk_place_downcast_unnamed(dest, variant_index);
|
||||||
let src = self.tcx.mk_place_downcast_unnamed(src, variant_index);
|
let src = self.tcx.mk_place_downcast_unnamed(src, variant_index);
|
||||||
let start_block = self.block_index_offset(0);
|
|
||||||
let clone_block = self.block_index_offset(1);
|
let clone_block = self.block_index_offset(1);
|
||||||
cases.push((index as u128, start_block));
|
let start_block = self.block(
|
||||||
self.block(
|
|
||||||
vec![self.make_statement(StatementKind::SetDiscriminant {
|
vec![self.make_statement(StatementKind::SetDiscriminant {
|
||||||
place: Box::new(Place::return_place()),
|
place: Box::new(Place::return_place()),
|
||||||
variant_index,
|
variant_index,
|
||||||
|
@ -548,6 +546,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
|
||||||
TerminatorKind::Goto { target: clone_block },
|
TerminatorKind::Goto { target: clone_block },
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
cases.push((index as u128, start_block));
|
||||||
let _final_cleanup_block = self.clone_fields(dest, src, target, unwind, state_tys);
|
let _final_cleanup_block = self.clone_fields(dest, src, target, unwind, state_tys);
|
||||||
}
|
}
|
||||||
let discr_ty = substs.discr_ty(self.tcx);
|
let discr_ty = substs.discr_ty(self.tcx);
|
||||||
|
|
|
@ -1943,15 +1943,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
|
self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
|
||||||
let resolved_witness =
|
let resolved_witness =
|
||||||
self.infcx.shallow_resolve(substs.as_generator().witness());
|
self.infcx.shallow_resolve(substs.as_generator().witness());
|
||||||
if {
|
if resolved_upvars.is_ty_var() || resolved_witness.is_ty_var() {
|
||||||
matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_)))
|
|
||||||
|| matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_)))
|
|
||||||
} {
|
|
||||||
// Not yet resolved.
|
// Not yet resolved.
|
||||||
Ambiguous
|
Ambiguous
|
||||||
} else {
|
} else {
|
||||||
let mut all = substs.as_generator().upvar_tys().collect::<Vec<_>>();
|
let all = substs
|
||||||
all.push(substs.as_generator().witness());
|
.as_generator()
|
||||||
|
.upvar_tys()
|
||||||
|
.chain(iter::once(substs.as_generator().witness()))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
Where(obligation.predicate.rebind(all))
|
Where(obligation.predicate.rebind(all))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1961,31 +1961,17 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
|
|
||||||
ty::GeneratorWitness(binder) => {
|
ty::GeneratorWitness(binder) => {
|
||||||
let witness_tys = binder.skip_binder();
|
let witness_tys = binder.skip_binder();
|
||||||
let mut iter = witness_tys.iter();
|
for witness_ty in witness_tys.iter() {
|
||||||
loop {
|
|
||||||
match iter.next() {
|
|
||||||
Some(witness_ty) => {
|
|
||||||
let resolved = self.infcx.shallow_resolve(witness_ty);
|
let resolved = self.infcx.shallow_resolve(witness_ty);
|
||||||
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
|
if resolved.is_ty_var() {
|
||||||
break Ambiguous;
|
return Ambiguous;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Option::None => {
|
|
||||||
// (*) binder moved here
|
// (*) binder moved here
|
||||||
let all_vars = self.tcx().mk_bound_variable_kinds(
|
let all_vars = self.tcx().mk_bound_variable_kinds(
|
||||||
obligation
|
obligation.predicate.bound_vars().iter().chain(binder.bound_vars().iter()),
|
||||||
.predicate
|
|
||||||
.bound_vars()
|
|
||||||
.iter()
|
|
||||||
.chain(binder.bound_vars().iter()),
|
|
||||||
);
|
);
|
||||||
break Where(ty::Binder::bind_with_vars(
|
Where(ty::Binder::bind_with_vars(witness_tys.to_vec(), all_vars))
|
||||||
witness_tys.to_vec(),
|
|
||||||
all_vars,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::Closure(_, substs) => {
|
ty::Closure(_, substs) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue