Skip to content

Commit a5cb3cc

Browse files
canndrewcrlf0710
authored andcommitted
loosen restriction on when GeneratorWitness: Clone
1 parent 0228c07 commit a5cb3cc

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
@@ -1958,23 +1958,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19581958
}
19591959

19601960
ty::GeneratorWitness(binder) => {
1961-
match binder.no_bound_vars() {
1962-
Some(tys) => {
1963-
let mut iter = tys.iter();
1964-
loop {
1965-
let ty = match iter.next() {
1966-
Some(ty) => ty,
1967-
Option::None => {
1968-
break Where(obligation.predicate.rebind(tys.to_vec()))
1969-
},
1970-
};
1971-
let resolved = self.infcx.shallow_resolve(ty);
1972-
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
1973-
break Ambiguous;
1974-
}
1975-
}
1976-
},
1977-
Option::None => None,
1961+
let tys = self.tcx().erase_late_bound_regions(binder);
1962+
let mut iter = tys.iter();
1963+
loop {
1964+
let ty = match iter.next() {
1965+
Some(ty) => ty,
1966+
Option::None => {
1967+
break Where(obligation.predicate.rebind(tys.to_vec()))
1968+
},
1969+
};
1970+
let resolved = self.infcx.shallow_resolve(ty);
1971+
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
1972+
break Ambiguous;
1973+
}
19781974
}
19791975
}
19801976

0 commit comments

Comments
 (0)