Skip to content

Commit 1caaf8a

Browse files
Split out into another structure
1 parent 7205fc5 commit 1caaf8a

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
340340
fn coroutine_hidden_types(
341341
self,
342342
def_id: DefId,
343-
) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, &'tcx ty::List<Ty<'tcx>>>> {
343+
) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, ty::CoroutineWitnessTypes<TyCtxt<'tcx>>>> {
344344
self.coroutine_hidden_types(def_id)
345345
}
346346

compiler/rustc_middle/src/ty/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ impl<'tcx> TyCtxt<'tcx> {
743743
pub fn coroutine_hidden_types(
744744
self,
745745
def_id: DefId,
746-
) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, &'tcx ty::List<Ty<'tcx>>>> {
746+
) -> ty::EarlyBinder<'tcx, ty::Binder<'tcx, ty::CoroutineWitnessTypes<TyCtxt<'tcx>>>> {
747747
let coroutine_layout = self.mir_coroutine_witnesses(def_id);
748748
let mut vars = vec![];
749749
let bound_tys = self.mk_type_list_from_iter(
@@ -766,7 +766,7 @@ impl<'tcx> TyCtxt<'tcx> {
766766
}),
767767
);
768768
ty::EarlyBinder::bind(ty::Binder::bind_with_vars(
769-
bound_tys,
769+
ty::CoroutineWitnessTypes { types: bound_tys },
770770
self.mk_bound_variable_kinds(&vars),
771771
))
772772
}

compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ where
8383
.cx()
8484
.coroutine_hidden_types(def_id)
8585
.instantiate(cx, args)
86-
.map_bound(|tys| tys.to_vec())),
86+
.map_bound(|bound| bound.types.to_vec())),
8787

8888
ty::UnsafeBinder(bound_ty) => Ok(bound_ty.map_bound(|ty| vec![ty])),
8989

@@ -249,7 +249,7 @@ where
249249
.cx()
250250
.coroutine_hidden_types(def_id)
251251
.instantiate(ecx.cx(), args)
252-
.map_bound(|tys| tys.to_vec())),
252+
.map_bound(|bound| bound.types.to_vec())),
253253
}
254254
}
255255

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,7 @@ fn rebind_coroutine_witness_types<'tcx>(
28662866
let shifted_coroutine_types =
28672867
tcx.shift_bound_var_indices(bound_vars.len(), bound_coroutine_types.skip_binder());
28682868
ty::Binder::bind_with_vars(
2869-
ty::EarlyBinder::bind(shifted_coroutine_types.to_vec()).instantiate(tcx, args),
2869+
ty::EarlyBinder::bind(shifted_coroutine_types.types.to_vec()).instantiate(tcx, args),
28702870
tcx.mk_bound_variable_kinds_from_iter(
28712871
bound_vars.iter().chain(bound_coroutine_types.bound_vars()),
28722872
),

compiler/rustc_type_ir/src/interner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub trait Interner:
210210
fn coroutine_hidden_types(
211211
self,
212212
def_id: Self::DefId,
213-
) -> ty::EarlyBinder<Self, ty::Binder<Self, Self::Tys>>;
213+
) -> ty::EarlyBinder<Self, ty::Binder<Self, ty::CoroutineWitnessTypes<Self>>>;
214214

215215
fn fn_sig(
216216
self,

compiler/rustc_type_ir/src/ty_kind.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,3 +1163,14 @@ pub struct FnHeader<I: Interner> {
11631163
pub safety: I::Safety,
11641164
pub abi: I::Abi,
11651165
}
1166+
1167+
#[derive_where(Clone, Copy, Debug, PartialEq, Eq, Hash; I: Interner)]
1168+
#[cfg_attr(
1169+
feature = "nightly",
1170+
derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext)
1171+
)]
1172+
#[derive(TypeVisitable_Generic, TypeFoldable_Generic, Lift_Generic)]
1173+
pub struct CoroutineWitnessTypes<I: Interner> {
1174+
pub types: I::Tys,
1175+
pub assumptions:
1176+
}

0 commit comments

Comments
 (0)