Skip to content

Commit fd4c7e3

Browse files
committed
cleanup PR
1 parent d4f1eaf commit fd4c7e3

File tree

2 files changed

+3
-20
lines changed
  • compiler
    • rustc_trait_selection/src/traits/select
    • rustc_typeck/src/check

2 files changed

+3
-20
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17021702
/// Zed<i32> where enum Zed { A(T), B(u32) } -> [i32, u32]
17031703
/// ```
17041704
fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Vec<Ty<'tcx>> {
1705-
debug!("near the bug!");
17061705
match *t.kind() {
17071706
ty::Uint(_)
17081707
| ty::Int(_)
@@ -1751,11 +1750,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17511750
ty::Generator(_, ref substs, _) => {
17521751
let upvar_tys_resolved =
17531752
self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
1754-
let witness_resolved = self.infcx.shallow_resolve(substs.as_generator().witness());
17551753

17561754
if let ty::Infer(ty::TyVar(_)) = upvar_tys_resolved.kind() {
17571755
// The inference variable will be replaced by a tuple once capture analysis
17581756
// completes, if the tuple meets a bound, so do all the elements within it.
1757+
let witness_resolved =
1758+
self.infcx.shallow_resolve(substs.as_generator().witness());
17591759
vec![upvar_tys_resolved, witness_resolved]
17601760
} else {
17611761
let witness = substs.as_generator().witness();

compiler/rustc_typeck/src/check/upvar.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,24 +206,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
206206
// Build a tuple (U0..Un) of the final upvar types U0..Un
207207
// and unify the upvar tupe type in the closure with it:
208208
let final_tupled_upvars_type = self.tcx.mk_tup(final_upvar_tys.iter());
209-
// self.demand_suptype(span, substs.tupled_upvars_ty(), final_tupled_upvars_type);
210-
211-
match *ty.kind() {
212-
ty::Closure(_, ref substs) => self.demand_suptype(
213-
span,
214-
substs.as_closure().tupled_upvars_ty(),
215-
final_tupled_upvars_type,
216-
),
217-
ty::Generator(_, ref substs, _) => self.demand_suptype(
218-
span,
219-
substs.as_generator().tupled_upvars_ty(),
220-
final_tupled_upvars_type,
221-
),
222-
_ => bug!("Type not handled!"),
223-
}
224-
225-
debug!("Capture analysis done");
226-
debug!("{}", substs.tupled_upvars_ty());
209+
self.demand_suptype(span, substs.tupled_upvars_ty(), final_tupled_upvars_type);
227210

228211
// If we are also inferred the closure kind here,
229212
// process any deferred resolutions.

0 commit comments

Comments
 (0)