@@ -69,7 +69,7 @@ use rustc_middle::ty::{
69
69
self ,
70
70
error:: TypeError ,
71
71
subst:: { GenericArgKind , Subst , SubstsRef } ,
72
- Binder , Region , Ty , TyCtxt , TypeFoldable ,
72
+ Binder , List , Region , Ty , TyCtxt , TypeFoldable ,
73
73
} ;
74
74
use rustc_span:: { sym, BytePos , DesugaringKind , MultiSpan , Pos , Span } ;
75
75
use rustc_target:: spec:: abi;
@@ -1361,7 +1361,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1361
1361
let mut values =
1362
1362
( DiagnosticStyledString :: normal ( "(" ) , DiagnosticStyledString :: normal ( "(" ) ) ;
1363
1363
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 ( ) {
1365
1365
let ( x1, x2) = self . cmp ( left, right) ;
1366
1366
( values. 0 ) . 0 . extend ( x1. 0 ) ;
1367
1367
( values. 1 ) . 0 . extend ( x2. 0 ) ;
@@ -2042,8 +2042,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
2042
2042
// If a tuple of length one was expected and the found expression has
2043
2043
// parentheses around it, perhaps the user meant to write `(expr,)` to
2044
2044
// 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 )
2047
2047
}
2048
2048
// If a character was expected and the found expression is a string literal
2049
2049
// containing a single character, perhaps the user meant to write `'c'` to
@@ -2111,12 +2111,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
2111
2111
err : & mut DiagnosticBuilder < ' tcx > ,
2112
2112
span : Span ,
2113
2113
found : Ty < ' tcx > ,
2114
- expected : Ty < ' tcx > ,
2114
+ expected_fields : & List < Ty < ' tcx > > ,
2115
2115
) {
2116
- let [ expected_tup_elem] = & expected. tuple_fields ( ) . collect :: < Vec < _ > > ( ) [ ..]
2117
- else { return } ;
2116
+ let [ expected_tup_elem] = expected_fields[ ..] else { return } ;
2118
2117
2119
- if !same_type_modulo_infer ( * expected_tup_elem, found) {
2118
+ if !same_type_modulo_infer ( expected_tup_elem, found) {
2120
2119
return ;
2121
2120
}
2122
2121
0 commit comments