diff options
| author | Andrew Cann <shum@canndrew.org> | 2022-03-14 10:24:10 +0800 |
|---|---|---|
| committer | Charles Lew <crlf0710@gmail.com> | 2022-09-11 14:04:15 +0800 |
| commit | a5cb3cca5ed28ccf865e7dbe74262e9744427bbe (patch) | |
| tree | d36b5c1d118077df47255cf268f829dc3e219120 | |
| parent | 0228c073e07bc36ab4dbb88ab7f3cbdf00832d59 (diff) | |
| download | rust-a5cb3cca5ed28ccf865e7dbe74262e9744427bbe.tar.gz rust-a5cb3cca5ed28ccf865e7dbe74262e9744427bbe.zip | |
loosen restriction on when GeneratorWitness: Clone
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 0e7483847e3..5f9f9847b23 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1958,23 +1958,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } ty::GeneratorWitness(binder) => { - match binder.no_bound_vars() { - Some(tys) => { - let mut iter = tys.iter(); - loop { - let ty = match iter.next() { - Some(ty) => ty, - Option::None => { - break Where(obligation.predicate.rebind(tys.to_vec())) - }, - }; - let resolved = self.infcx.shallow_resolve(ty); - if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) { - break Ambiguous; - } - } - }, - Option::None => None, + let tys = self.tcx().erase_late_bound_regions(binder); + let mut iter = tys.iter(); + loop { + let ty = match iter.next() { + Some(ty) => ty, + Option::None => { + break Where(obligation.predicate.rebind(tys.to_vec())) + }, + }; + let resolved = self.infcx.shallow_resolve(ty); + if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) { + break Ambiguous; + } } } |
