@@ -72,7 +72,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
72
72
ty : Ty < ' tcx > ,
73
73
span : Span ,
74
74
base_expr : & hir:: Expr < ' _ > ,
75
- ) -> Option < ( Ty < ' tcx > , Ty < ' tcx > ) > {
75
+ ) -> ( Ty < ' tcx > , Ty < ' tcx > ) {
76
76
let ty = self . resolve_vars_if_possible ( ty) ;
77
77
let mut err = self . dcx ( ) . struct_span_err (
78
78
span,
@@ -92,8 +92,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
92
92
Applicability :: MachineApplicable ,
93
93
) ;
94
94
}
95
- let reported = err. emit ( ) ;
96
- Some ( ( Ty :: new_error ( self . tcx , reported ) , Ty :: new_error ( self . tcx , reported ) ) )
95
+ let guar = err. emit ( ) ;
96
+ ( Ty :: new_error ( self . tcx , guar ) , Ty :: new_error ( self . tcx , guar ) )
97
97
}
98
98
99
99
/// To type-check `base_expr[index_expr]`, we progressively autoderef
@@ -109,7 +109,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
109
109
index_ty : Ty < ' tcx > ,
110
110
index_expr : & hir:: Expr < ' _ > ,
111
111
) -> Option < ( /*index type*/ Ty < ' tcx > , /*element type*/ Ty < ' tcx > ) > {
112
- let adjusted_ty = self . structurally_resolve_type ( autoderef. span ( ) , autoderef . final_ty ( ) ) ;
112
+ let adjusted_ty = autoderef. final_ty ( ) ;
113
113
debug ! (
114
114
"try_index_step(expr={:?}, base_expr={:?}, adjusted_ty={:?}, \
115
115
index_ty={:?})",
@@ -126,10 +126,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
126
126
{
127
127
match adjusted_ty. kind ( ) {
128
128
ty:: Adt ( def, _) if self . tcx . is_diagnostic_item ( sym:: Vec , def. did ( ) ) => {
129
- return self . negative_index ( adjusted_ty, index_expr. span , base_expr) ;
129
+ return Some ( self . negative_index ( adjusted_ty, index_expr. span , base_expr) ) ;
130
130
}
131
131
ty:: Slice ( _) | ty:: Array ( _, _) => {
132
- return self . negative_index ( adjusted_ty, index_expr. span , base_expr) ;
132
+ return Some ( self . negative_index ( adjusted_ty, index_expr. span , base_expr) ) ;
133
133
}
134
134
_ => { }
135
135
}
0 commit comments