@@ -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} ;
7474use rustc_span:: { sym, BytePos , DesugaringKind , MultiSpan , Pos , Span } ;
7575use 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
0 commit comments