Skip to content

Commit 0451205

Browse files
committed
loosen restriction on when GeneratorWitness: Clone
1 parent 5fca814 commit 0451205

File tree

1 file changed

+13
-17
lines changed
  • compiler/rustc_trait_selection/src/traits/select

1 file changed

+13
-17
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,23 +1917,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19171917
}
19181918

19191919
ty::GeneratorWitness(binder) => {
1920-
match binder.no_bound_vars() {
1921-
Some(tys) => {
1922-
let mut iter = tys.iter();
1923-
loop {
1924-
let ty = match iter.next() {
1925-
Some(ty) => ty,
1926-
Option::None => {
1927-
break Where(obligation.predicate.rebind(tys.to_vec()))
1928-
},
1929-
};
1930-
let resolved = self.infcx.shallow_resolve(ty);
1931-
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
1932-
break Ambiguous;
1933-
}
1934-
}
1935-
},
1936-
Option::None => None,
1920+
let tys = self.tcx().erase_late_bound_regions(binder);
1921+
let mut iter = tys.iter();
1922+
loop {
1923+
let ty = match iter.next() {
1924+
Some(ty) => ty,
1925+
Option::None => {
1926+
break Where(obligation.predicate.rebind(tys.to_vec()))
1927+
},
1928+
};
1929+
let resolved = self.infcx.shallow_resolve(ty);
1930+
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
1931+
break Ambiguous;
1932+
}
19371933
}
19381934
}
19391935

0 commit comments

Comments
 (0)