Skip to content

Commit d521e21

Browse files
Also migrate FnInputTys
1 parent 24e41f1 commit d521e21

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<I: Intern
258258
if sig.skip_binder().is_fn_trait_compatible() && !tcx.has_target_features(def_id) {
259259
Ok(Some(
260260
sig.instantiate(tcx, args)
261-
.map_bound(|sig| (Ty::new_tup(tcx, &sig.inputs()), sig.output())),
261+
.map_bound(|sig| (Ty::new_tup(tcx, sig.inputs().as_slice()), sig.output())),
262262
))
263263
} else {
264264
Err(NoSolution)
@@ -267,7 +267,9 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<I: Intern
267267
// keep this in sync with assemble_fn_pointer_candidates until the old solver is removed.
268268
ty::FnPtr(sig) => {
269269
if sig.is_fn_trait_compatible() {
270-
Ok(Some(sig.map_bound(|sig| (Ty::new_tup(tcx, &sig.inputs()), sig.output()))))
270+
Ok(Some(
271+
sig.map_bound(|sig| (Ty::new_tup(tcx, sig.inputs().as_slice()), sig.output())),
272+
))
271273
} else {
272274
Err(NoSolution)
273275
}
@@ -290,7 +292,9 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<I: Intern
290292
}
291293
}
292294
}
293-
Ok(Some(closure_args.sig().map_bound(|sig| (sig.inputs()[0], sig.output()))))
295+
Ok(Some(
296+
closure_args.sig().map_bound(|sig| (sig.inputs().get(0).unwrap(), sig.output())),
297+
))
294298
}
295299

296300
// Coroutine-closures don't implement `Fn` traits the normal way.
@@ -468,7 +472,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
468472
let future_output_ty = Ty::new_projection(tcx, future_output_def_id, [sig.output()]);
469473
Ok((
470474
bound_sig.rebind(AsyncCallableRelevantTypes {
471-
tupled_inputs_ty: Ty::new_tup(tcx, &sig.inputs()),
475+
tupled_inputs_ty: Ty::new_tup(tcx, sig.inputs().as_slice()),
472476
output_coroutine_ty: sig.output(),
473477
coroutine_return_ty: future_output_ty,
474478
}),
@@ -519,7 +523,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
519523
let future_output_ty = Ty::new_projection(tcx, future_output_def_id, [sig.output()]);
520524
Ok((
521525
bound_sig.rebind(AsyncCallableRelevantTypes {
522-
tupled_inputs_ty: sig.inputs()[0],
526+
tupled_inputs_ty: sig.inputs().get(0).unwrap(),
523527
output_coroutine_ty: sig.output(),
524528
coroutine_return_ty: future_output_ty,
525529
}),

compiler/rustc_type_ir/src/interner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub trait Interner:
9090
// Kinds of tys
9191
type Ty: Ty<Self>;
9292
type Tys: Tys<Self>;
93-
type FnInputTys: Copy + Debug + Hash + Eq + Deref<Target = [Self::Ty]> + TypeVisitable<Self>;
93+
type FnInputTys: Copy + Debug + Hash + Eq + SliceLike<Item = Self::Ty> + TypeVisitable<Self>;
9494
type ParamTy: Copy + Debug + Hash + Eq + ParamLike;
9595
type BoundTy: Copy + Debug + Hash + Eq + BoundVarLike<Self>;
9696
type PlaceholderTy: PlaceholderLike;

compiler/rustc_type_ir/src/predicate_kind.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ impl std::fmt::Display for AliasRelationDirection {
127127
}
128128
}
129129

130-
// FIXME: Convert to DebugWithInfcx impl
131130
impl<I: Interner> fmt::Debug for ClauseKind<I> {
132131
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
133132
match self {
@@ -144,7 +143,6 @@ impl<I: Interner> fmt::Debug for ClauseKind<I> {
144143
}
145144
}
146145

147-
// FIXME: Convert to DebugWithInfcx impl
148146
impl<I: Interner> fmt::Debug for PredicateKind<I> {
149147
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
150148
match self {

compiler/rustc_type_ir/src/relate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl<I: Interner> Relate<I> for ty::FnSig<I> {
185185
}
186186

187187
let inputs_and_output = iter::zip(a_inputs.iter(), b_inputs.iter())
188-
.map(|(&a, &b)| ((a, b), false))
188+
.map(|(a, b)| ((a, b), false))
189189
.chain(iter::once(((a.output(), b.output()), true)))
190190
.map(|((a, b), is_output)| {
191191
if is_output {

compiler/rustc_type_ir/src/ty_kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ impl<I: Interner> ty::Binder<I, FnSig<I>> {
10051005
#[inline]
10061006
#[track_caller]
10071007
pub fn input(self, index: usize) -> ty::Binder<I, I::Ty> {
1008-
self.map_bound(|fn_sig| fn_sig.inputs()[index])
1008+
self.map_bound(|fn_sig| fn_sig.inputs().get(index).unwrap())
10091009
}
10101010

10111011
pub fn inputs_and_output(self) -> ty::Binder<I, I::Tys> {

compiler/rustc_type_ir/src/ty_kind/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<I: Interner> CoroutineClosureArgs<I> {
309309
let interior = self.coroutine_witness_ty();
310310
let ty::FnPtr(sig) = self.signature_parts_ty().kind() else { panic!() };
311311
sig.map_bound(|sig| {
312-
let [resume_ty, tupled_inputs_ty] = *sig.inputs() else {
312+
let [resume_ty, tupled_inputs_ty] = *sig.inputs().as_slice() else {
313313
panic!();
314314
};
315315
let [yield_ty, return_ty] = *sig.output().tuple_fields().as_slice() else { panic!() };

0 commit comments

Comments
 (0)