@@ -235,7 +235,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
235
235
. pat_binding_modes_mut ( )
236
236
. insert ( pat. hir_id , bm) ;
237
237
debug ! ( "check_pat_walk: pat.hir_id={:?} bm={:?}" , pat. hir_id, bm) ;
238
- let typ = self . local_ty ( pat. span , pat. id ) ;
238
+ let local_ty = self . local_ty ( pat. span , pat. id ) . decl_ty ;
239
239
match bm {
240
240
ty:: BindByReference ( mutbl) => {
241
241
// if the binding is like
@@ -249,28 +249,28 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
249
249
// `x` is assigned a value of type `&M T`, hence `&M T <: typeof(x)` is
250
250
// required. However, we use equality, which is stronger. See (*) for
251
251
// an explanation.
252
- self . demand_eqtype ( pat. span , region_ty, typ ) ;
252
+ self . demand_eqtype ( pat. span , region_ty, local_ty ) ;
253
253
}
254
254
// otherwise the type of x is the expected type T
255
255
ty:: BindByValue ( _) => {
256
256
// As above, `T <: typeof(x)` is required but we
257
257
// use equality, see (*) below.
258
- self . demand_eqtype ( pat. span , expected, typ ) ;
258
+ self . demand_eqtype ( pat. span , expected, local_ty ) ;
259
259
}
260
260
}
261
261
262
262
// if there are multiple arms, make sure they all agree on
263
263
// what the type of the binding `x` ought to be
264
264
if var_id != pat. id {
265
- let vt = self . local_ty ( pat. span , var_id) ;
266
- self . demand_eqtype ( pat. span , vt, typ ) ;
265
+ let vt = self . local_ty ( pat. span , var_id) . decl_ty ;
266
+ self . demand_eqtype ( pat. span , vt, local_ty ) ;
267
267
}
268
268
269
269
if let Some ( ref p) = * sub {
270
270
self . check_pat_walk ( & p, expected, def_bm, true ) ;
271
271
}
272
272
273
- typ
273
+ local_ty
274
274
}
275
275
PatKind :: TupleStruct ( ref qpath, ref subpats, ddpos) => {
276
276
self . check_pat_tuple_struct ( pat, qpath, & subpats, ddpos, expected, def_bm)
0 commit comments