Skip to content

Commit 1245131

Browse files
committed
use List<Ty<'tcx>> for tuples
1 parent a9c1ab8 commit 1245131

File tree

53 files changed

+128
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+128
-170
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22982298
// Closure arguments are wrapped in a tuple, so we need to get the first
22992299
// from that.
23002300
if let ty::Tuple(elems) = argument_ty.kind() {
2301-
let argument_ty = elems.first()?.expect_ty();
2301+
let &argument_ty = elems.first()?;
23022302
if let ty::Ref(_, _, _) = argument_ty.kind() {
23032303
return Some(AnnotatedBorrowFnSignature::Closure {
23042304
argument_ty,

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
480480
let search_stack: &mut Vec<(Ty<'tcx>, &hir::Ty<'_>)> = &mut vec![(ty, hir_ty)];
481481

482482
while let Some((ty, hir_ty)) = search_stack.pop() {
483-
match (&ty.kind(), &hir_ty.kind) {
483+
match (ty.kind(), &hir_ty.kind) {
484484
// Check if the `ty` is `&'X ..` where `'X`
485485
// is the region we are looking for -- if so, and we have a `&T`
486486
// on the RHS, then we want to highlight the `&` like so:
@@ -532,9 +532,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
532532
// The following cases don't have lifetimes, so we
533533
// just worry about trying to match up the rustc type
534534
// with the HIR types:
535-
(ty::Tuple(elem_tys), hir::TyKind::Tup(elem_hir_tys)) => {
536-
search_stack
537-
.extend(iter::zip(elem_tys.iter().map(|k| k.expect_ty()), *elem_hir_tys));
535+
(&ty::Tuple(elem_tys), hir::TyKind::Tup(elem_hir_tys)) => {
536+
search_stack.extend(iter::zip(elem_tys, *elem_hir_tys));
538537
}
539538

540539
(ty::Slice(elem_ty), hir::TyKind::Slice(elem_hir_ty))

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,10 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
832832
return match substs
833833
.as_closure()
834834
.tupled_upvars_ty()
835-
.tuple_element_ty(field.index())
835+
.tuple_fields()
836+
.get(field.index())
836837
{
837-
Some(ty) => Ok(ty),
838+
Some(&ty) => Ok(ty),
838839
None => Err(FieldAccessError::OutOfRange {
839840
field_count: substs.as_closure().upvar_tys().count(),
840841
}),
@@ -852,7 +853,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
852853
}
853854
ty::Tuple(tys) => {
854855
return match tys.get(field.index()) {
855-
Some(&ty) => Ok(ty.expect_ty()),
856+
Some(&ty) => Ok(ty),
856857
None => Err(FieldAccessError::OutOfRange { field_count: tys.len() }),
857858
};
858859
}

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,15 +641,13 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
641641
let (&output, tuplized_inputs) =
642642
inputs_and_output.skip_binder().split_last().unwrap();
643643
assert_eq!(tuplized_inputs.len(), 1, "multiple closure inputs");
644-
let ty::Tuple(inputs) = tuplized_inputs[0].kind() else {
644+
let &ty::Tuple(inputs) = tuplized_inputs[0].kind() else {
645645
bug!("closure inputs not a tuple: {:?}", tuplized_inputs[0]);
646646
};
647647

648648
ty::Binder::bind_with_vars(
649649
tcx.mk_type_list(
650-
iter::once(closure_ty)
651-
.chain(inputs.iter().map(|k| k.expect_ty()))
652-
.chain(iter::once(output)),
650+
iter::once(closure_ty).chain(inputs).chain(iter::once(output)),
653651
),
654652
bound_vars,
655653
)

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
117117
.unzip();
118118
let return_layout = self.layout_of(return_ty);
119119
let return_tys = if let ty::Tuple(tup) = return_ty.kind() {
120-
tup.types().map(|ty| AbiParam::new(self.clif_type(ty).unwrap())).collect()
120+
tup.iter().map(|ty| AbiParam::new(self.clif_type(ty).unwrap())).collect()
121121
} else {
122122
vec![AbiParam::new(self.clif_type(return_ty).unwrap())]
123123
};
@@ -199,7 +199,7 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
199199
};
200200

201201
let mut params = Vec::new();
202-
for (i, _arg_ty) in tupled_arg_tys.types().enumerate() {
202+
for (i, _arg_ty) in tupled_arg_tys.iter().enumerate() {
203203
let arg_abi = arg_abis_iter.next().unwrap();
204204
let param =
205205
cvalue_for_param(fx, Some(local), Some(i), arg_abi, &mut block_params_iter);

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ fn clif_pair_type_from_ty<'tcx>(
9090
ty: Ty<'tcx>,
9191
) -> Option<(types::Type, types::Type)> {
9292
Some(match ty.kind() {
93-
ty::Tuple(substs) if substs.len() == 2 => {
94-
let mut types = substs.types();
95-
let a = clif_type_from_ty(tcx, types.next().unwrap())?;
96-
let b = clif_type_from_ty(tcx, types.next().unwrap())?;
93+
ty::Tuple(types) if types.len() == 2 => {
94+
let a = clif_type_from_ty(tcx, types[0])?;
95+
let b = clif_type_from_ty(tcx, types[1])?;
9796
if a.is_vector() || b.is_vector() {
9897
return None;
9998
}

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,8 @@ pub fn type_metadata<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll
752752
prepare_enum_metadata(cx, t, def.did, unique_type_id, vec![]).finalize(cx)
753753
}
754754
},
755-
ty::Tuple(elements) => {
756-
let tys: Vec<_> = elements.iter().map(|k| k.expect_ty()).collect();
757-
prepare_tuple_metadata(cx, t, &tys, unique_type_id, NO_SCOPE_METADATA).finalize(cx)
755+
ty::Tuple(tys) => {
756+
prepare_tuple_metadata(cx, t, tys, unique_type_id, NO_SCOPE_METADATA).finalize(cx)
758757
}
759758
// Type parameters from polymorphized functions.
760759
ty::Param(_) => MetadataCreationResult::new(param_type_metadata(cx, t), false),

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn push_debuginfo_type_name<'tcx>(
8686
}
8787

8888
for component_type in component_types {
89-
push_debuginfo_type_name(tcx, component_type.expect_ty(), true, output, visited);
89+
push_debuginfo_type_name(tcx, component_type, true, output, visited);
9090
push_arg_separator(cpp_like_debuginfo, output);
9191
}
9292
if !component_types.is_empty() {

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use rustc_middle::ty::{
6969
self,
7070
error::TypeError,
7171
subst::{GenericArgKind, Subst, SubstsRef},
72-
Binder, Region, Ty, TyCtxt, TypeFoldable,
72+
Binder, List, Region, Ty, TyCtxt, TypeFoldable,
7373
};
7474
use rustc_span::{sym, BytePos, DesugaringKind, MultiSpan, Pos, Span};
7575
use rustc_target::spec::abi;
@@ -1361,7 +1361,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13611361
let mut values =
13621362
(DiagnosticStyledString::normal("("), DiagnosticStyledString::normal("("));
13631363
let len = substs1.len();
1364-
for (i, (left, right)) in substs1.types().zip(substs2.types()).enumerate() {
1364+
for (i, (left, right)) in substs1.iter().zip(substs2).enumerate() {
13651365
let (x1, x2) = self.cmp(left, right);
13661366
(values.0).0.extend(x1.0);
13671367
(values.1).0.extend(x2.0);
@@ -2042,8 +2042,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
20422042
// If a tuple of length one was expected and the found expression has
20432043
// parentheses around it, perhaps the user meant to write `(expr,)` to
20442044
// build a tuple (issue #86100)
2045-
(ty::Tuple(_), _) => {
2046-
self.emit_tuple_wrap_err(&mut err, span, found, expected)
2045+
(ty::Tuple(fields), _) => {
2046+
self.emit_tuple_wrap_err(&mut err, span, found, fields)
20472047
}
20482048
// If a character was expected and the found expression is a string literal
20492049
// containing a single character, perhaps the user meant to write `'c'` to
@@ -2111,12 +2111,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
21112111
err: &mut DiagnosticBuilder<'tcx>,
21122112
span: Span,
21132113
found: Ty<'tcx>,
2114-
expected: Ty<'tcx>,
2114+
expected_fields: &List<Ty<'tcx>>,
21152115
) {
2116-
let [expected_tup_elem] = &expected.tuple_fields().collect::<Vec<_>>()[..]
2117-
else { return };
2116+
let [expected_tup_elem] = expected_fields[..] else { return };
21182117

2119-
if !same_type_modulo_infer(*expected_tup_elem, found) {
2118+
if !same_type_modulo_infer(expected_tup_elem, found) {
21202119
return;
21212120
}
21222121

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ fn closure_args(fn_sig: &ty::PolyFnSig<'_>) -> String {
254254
.skip_binder()
255255
.iter()
256256
.next()
257-
.map(|args| args.tuple_fields().map(|arg| arg.to_string()).collect::<Vec<_>>().join(", "))
257+
.map(|args| {
258+
args.tuple_fields().iter().map(|arg| arg.to_string()).collect::<Vec<_>>().join(", ")
259+
})
258260
.unwrap_or_default()
259261
}
260262

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,7 +2621,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26212621
}
26222622
Tuple(..) => {
26232623
// Proceed recursively, check all fields.
2624-
ty.tuple_fields().find_map(|field| ty_find_init_error(tcx, field, init))
2624+
ty.tuple_fields().iter().find_map(|field| ty_find_init_error(tcx, field, init))
26252625
}
26262626
// Conservative fallback.
26272627
_ => None,
@@ -2934,7 +2934,7 @@ impl ClashingExternDeclarations {
29342934
)
29352935
}
29362936
(Tuple(a_substs), Tuple(b_substs)) => {
2937-
a_substs.types().eq_by(b_substs.types(), |a_ty, b_ty| {
2937+
a_substs.iter().eq_by(b_substs.iter(), |a_ty, b_ty| {
29382938
structurally_same_type_impl(seen_types, cx, a_ty, b_ty, ckind)
29392939
})
29402940
}

compiler/rustc_lint/src/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
246246
} else {
247247
vec![]
248248
};
249-
for (i, ty) in tys.iter().map(|k| k.expect_ty()).enumerate() {
249+
for (i, ty) in tys.iter().enumerate() {
250250
let descr_post = &format!(" in tuple element {}", i);
251251
let span = *spans.get(i).unwrap_or(&span);
252252
if check_must_use_ty(cx, ty, expr, span, descr_pre, descr_post, plural_len)

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ fn use_verbose<'tcx>(ty: Ty<'tcx>, fn_def: bool) -> bool {
427427
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => false,
428428
// Unit type
429429
ty::Tuple(g_args) if g_args.is_empty() => false,
430-
ty::Tuple(g_args) => g_args.iter().any(|g_arg| use_verbose(g_arg.expect_ty(), fn_def)),
430+
ty::Tuple(g_args) => g_args.iter().any(|g_arg| use_verbose(g_arg, fn_def)),
431431
ty::Array(ty, _) => use_verbose(ty, fn_def),
432432
ty::FnDef(..) => fn_def,
433433
_ => true,

compiler/rustc_middle/src/mir/tcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'tcx> PlaceTy<'tcx> {
4646
let field_def = &variant_def.fields[f.index()];
4747
field_def.ty(tcx, substs)
4848
}
49-
ty::Tuple(ref tys) => tys[f.index()].expect_ty(),
49+
ty::Tuple(tys) => tys[f.index()],
5050
_ => bug!("extracting field of non-tuple non-adt: {:?}", self),
5151
};
5252
debug!("field_ty self: {:?} f: {:?} yields: {:?}", self, f, answer);

compiler/rustc_middle/src/ty/context.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ impl<'tcx> TyCtxt<'tcx> {
22722272
) -> PolyFnSig<'tcx> {
22732273
sig.map_bound(|s| {
22742274
let params_iter = match s.inputs()[0].kind() {
2275-
ty::Tuple(params) => params.into_iter().map(|k| k.expect_ty()),
2275+
ty::Tuple(params) => params.into_iter(),
22762276
_ => bug!(),
22772277
};
22782278
self.mk_fn_sig(params_iter, s.output(), s.c_variadic, unsafety, abi::Abi::Rust)
@@ -2434,15 +2434,11 @@ impl<'tcx> TyCtxt<'tcx> {
24342434

24352435
#[inline]
24362436
pub fn intern_tup(self, ts: &[Ty<'tcx>]) -> Ty<'tcx> {
2437-
let kinds: Vec<_> = ts.iter().map(|&t| GenericArg::from(t)).collect();
2438-
self.mk_ty(Tuple(self.intern_substs(&kinds)))
2437+
self.mk_ty(Tuple(self.intern_type_list(&ts)))
24392438
}
24402439

24412440
pub fn mk_tup<I: InternAs<[Ty<'tcx>], Ty<'tcx>>>(self, iter: I) -> I::Output {
2442-
iter.intern_with(|ts| {
2443-
let kinds: Vec<_> = ts.iter().map(|&t| GenericArg::from(t)).collect();
2444-
self.mk_ty(Tuple(self.intern_substs(&kinds)))
2445-
})
2441+
iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(&ts))))
24462442
}
24472443

24482444
#[inline]

compiler/rustc_middle/src/ty/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ impl<'tcx> Ty<'tcx> {
116116
}
117117
_ => true,
118118
}),
119-
Projection(ProjectionTy { substs: args, .. }) | Adt(_, args) | Tuple(args) => {
119+
Projection(ProjectionTy { substs: args, .. }) | Adt(_, args) => {
120120
args.iter().all(generic_arg_is_suggestible)
121121
}
122+
Tuple(args) => args.iter().all(|ty| ty.is_suggestable()),
122123
Slice(ty) | RawPtr(TypeAndMut { ty, .. }) | Ref(_, ty, _) => ty.is_suggestable(),
123124
Array(ty, c) => ty.is_suggestable() && const_is_suggestable(c.val()),
124125
_ => true,

compiler/rustc_middle/src/ty/flags.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ impl FlagComputation {
201201
self.add_ty(ty);
202202
}
203203

204-
&ty::Tuple(ref substs) => {
205-
self.add_substs(substs);
204+
&ty::Tuple(types) => {
205+
self.add_tys(types);
206206
}
207207

208208
&ty::FnDef(_, substs) => {

compiler/rustc_middle/src/ty/inhabitedness/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,9 @@ pub(crate) fn type_uninhabited_from<'tcx>(
207207

208208
Never => DefIdForest::full(),
209209

210-
Tuple(ref tys) => DefIdForest::union(
211-
tcx,
212-
tys.iter().map(|ty| ty.expect_ty().uninhabited_from(tcx, param_env)),
213-
),
210+
Tuple(ref tys) => {
211+
DefIdForest::union(tcx, tys.iter().map(|ty| ty.uninhabited_from(tcx, param_env)))
212+
}
214213

215214
Array(ty, len) => match len.try_eval_usize(tcx, param_env) {
216215
Some(0) | None => DefIdForest::empty(),

compiler/rustc_middle/src/ty/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ fn polymorphize<'tcx>(
628628
} else {
629629
None
630630
};
631-
let has_upvars = upvars_ty.map_or(false, |ty| ty.tuple_fields().count() > 0);
631+
let has_upvars = upvars_ty.map_or(false, |ty| !ty.tuple_fields().is_empty());
632632
debug!("polymorphize: upvars_ty={:?} has_upvars={:?}", upvars_ty, has_upvars);
633633

634634
struct PolymorphizationFolder<'tcx> {

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
712712
if tys.len() == 0 { StructKind::AlwaysSized } else { StructKind::MaybeUnsized };
713713

714714
univariant(
715-
&tys.iter()
716-
.map(|k| self.layout_of(k.expect_ty()))
717-
.collect::<Result<Vec<_>, _>>()?,
715+
&tys.iter().map(|k| self.layout_of(k)).collect::<Result<Vec<_>, _>>()?,
718716
&ReprOptions::default(),
719717
kind,
720718
)?
@@ -2382,7 +2380,7 @@ where
23822380
}
23832381
},
23842382

2385-
ty::Tuple(tys) => TyMaybeWithLayout::Ty(tys[i].expect_ty()),
2383+
ty::Tuple(tys) => TyMaybeWithLayout::Ty(tys[i]),
23862384

23872385
// ADTs.
23882386
ty::Adt(def, substs) => {
@@ -3012,7 +3010,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
30123010
if let Some(input) = sig.inputs().last() {
30133011
if let ty::Tuple(tupled_arguments) = input.kind() {
30143012
inputs = &sig.inputs()[0..sig.inputs().len() - 1];
3015-
tupled_arguments.iter().map(|k| k.expect_ty()).collect()
3013+
tupled_arguments
30163014
} else {
30173015
bug!(
30183016
"argument to function with \"rust-call\" ABI \
@@ -3027,7 +3025,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
30273025
}
30283026
} else {
30293027
assert!(sig.c_variadic || extra_args.is_empty());
3030-
extra_args.to_vec()
3028+
extra_args
30313029
};
30323030

30333031
let target = &self.tcx.sess.target;
@@ -3155,8 +3153,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
31553153
ret: arg_of(sig.output(), None)?,
31563154
args: inputs
31573155
.iter()
3158-
.cloned()
3159-
.chain(extra_args)
3156+
.copied()
3157+
.chain(extra_args.iter().copied())
31603158
.chain(caller_location)
31613159
.enumerate()
31623160
.map(|(i, ty)| arg_of(ty, Some(i)))

compiler/rustc_middle/src/ty/print/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ fn characteristic_def_id_of_type_cached<'a>(
287287
ty::Ref(_, ty, _) => characteristic_def_id_of_type_cached(ty, visited),
288288

289289
ty::Tuple(ref tys) => tys.iter().find_map(|ty| {
290-
let ty = ty.expect_ty();
291290
if visited.insert(ty) {
292291
return characteristic_def_id_of_type_cached(ty, visited);
293292
}

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ pub trait PrettyPrinter<'tcx>:
845845
write("{}{}(", if paren_needed { "(" } else { "" }, name)
846846
);
847847

848-
for (idx, ty) in arg_tys.tuple_fields().enumerate() {
848+
for (idx, ty) in arg_tys.tuple_fields().iter().enumerate() {
849849
if idx > 0 {
850850
p!(", ");
851851
}
@@ -1032,12 +1032,11 @@ pub trait PrettyPrinter<'tcx>:
10321032
// Special-case `Fn(...) -> ...` and resugar it.
10331033
let fn_trait_kind = cx.tcx().fn_trait_kind_from_lang_item(principal.def_id);
10341034
if !cx.tcx().sess.verbose() && fn_trait_kind.is_some() {
1035-
if let ty::Tuple(ref args) = principal.substs.type_at(0).kind() {
1035+
if let ty::Tuple(tys) = principal.substs.type_at(0).kind() {
10361036
let mut projections = predicates.projection_bounds();
10371037
if let (Some(proj), None) = (projections.next(), projections.next()) {
1038-
let tys: Vec<_> = args.iter().map(|k| k.expect_ty()).collect();
10391038
p!(pretty_fn_sig(
1040-
&tys,
1039+
tys,
10411040
false,
10421041
proj.skip_binder().term.ty().expect("Return type was a const")
10431042
));

compiler/rustc_middle/src/ty/relate.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,7 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
501501

502502
(&ty::Tuple(as_), &ty::Tuple(bs)) => {
503503
if as_.len() == bs.len() {
504-
Ok(tcx.mk_tup(
505-
iter::zip(as_, bs).map(|(a, b)| relation.relate(a.expect_ty(), b.expect_ty())),
506-
)?)
504+
Ok(tcx.mk_tup(iter::zip(as_, bs).map(|(a, b)| relation.relate(a, b)))?)
507505
} else if !(as_.is_empty() || bs.is_empty()) {
508506
Err(TypeError::TupleSize(expected_found(relation, as_.len(), bs.len())))
509507
} else {

0 commit comments

Comments
 (0)