@@ -72,7 +72,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
7272 ty : Ty < ' tcx > ,
7373 span : Span ,
7474 base_expr : & hir:: Expr < ' _ > ,
75- ) -> Option < ( Ty < ' tcx > , Ty < ' tcx > ) > {
75+ ) -> ( Ty < ' tcx > , Ty < ' tcx > ) {
7676 let ty = self . resolve_vars_if_possible ( ty) ;
7777 let mut err = self . dcx ( ) . struct_span_err (
7878 span,
@@ -92,8 +92,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
9292 Applicability :: MachineApplicable ,
9393 ) ;
9494 }
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 ) )
9797 }
9898
9999 /// To type-check `base_expr[index_expr]`, we progressively autoderef
@@ -109,7 +109,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
109109 index_ty : Ty < ' tcx > ,
110110 index_expr : & hir:: Expr < ' _ > ,
111111 ) -> 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 ( ) ;
113113 debug ! (
114114 "try_index_step(expr={:?}, base_expr={:?}, adjusted_ty={:?}, \
115115 index_ty={:?})",
@@ -126,10 +126,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
126126 {
127127 match adjusted_ty. kind ( ) {
128128 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) ) ;
130130 }
131131 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) ) ;
133133 }
134134 _ => { }
135135 }
0 commit comments