@@ -6,7 +6,7 @@ use rustc::hir::{self, PatKind, Pat, ExprKind};
6
6
use rustc:: hir:: def:: { Res , DefKind , CtorKind } ;
7
7
use rustc:: hir:: pat_util:: EnumerateAndAdjustIterator ;
8
8
use rustc:: infer;
9
- use rustc:: infer:: type_variable:: TypeVariableOrigin ;
9
+ use rustc:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
10
10
use rustc:: traits:: { ObligationCause , ObligationCauseCode } ;
11
11
use rustc:: ty:: { self , Ty , TypeFoldable } ;
12
12
use rustc:: ty:: subst:: Kind ;
@@ -311,9 +311,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
311
311
let max_len = cmp:: max ( expected_len, elements. len ( ) ) ;
312
312
313
313
let element_tys_iter = ( 0 ..max_len) . map ( |_| {
314
- // FIXME: `MiscVariable` for now -- obtaining the span and name information
315
- // from all tuple elements isn't trivial.
316
- Kind :: from ( self . next_ty_var ( TypeVariableOrigin :: TypeInference ( pat. span ) ) )
314
+ Kind :: from ( self . next_ty_var (
315
+ // FIXME: `MiscVariable` for now -- obtaining the span and name information
316
+ // from all tuple elements isn't trivial.
317
+ TypeVariableOrigin {
318
+ kind : TypeVariableOriginKind :: TypeInference ,
319
+ span : pat. span ,
320
+ } ,
321
+ ) )
317
322
} ) ;
318
323
let element_tys = tcx. mk_substs ( element_tys_iter) ;
319
324
let pat_ty = tcx. mk_ty ( ty:: Tuple ( element_tys) ) ;
@@ -339,7 +344,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
339
344
}
340
345
}
341
346
PatKind :: Box ( ref inner) => {
342
- let inner_ty = self . next_ty_var ( TypeVariableOrigin :: TypeInference ( inner. span ) ) ;
347
+ let inner_ty = self . next_ty_var ( TypeVariableOrigin {
348
+ kind : TypeVariableOriginKind :: TypeInference ,
349
+ span : inner. span ,
350
+ } ) ;
343
351
let uniq_ty = tcx. mk_box ( inner_ty) ;
344
352
345
353
if self . check_dereferencable ( pat. span , expected, & inner) {
@@ -372,7 +380,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
372
380
}
373
381
_ => {
374
382
let inner_ty = self . next_ty_var (
375
- TypeVariableOrigin :: TypeInference ( inner. span ) ) ;
383
+ TypeVariableOrigin {
384
+ kind : TypeVariableOriginKind :: TypeInference ,
385
+ span : inner. span ,
386
+ }
387
+ ) ;
376
388
let mt = ty:: TypeAndMut { ty : inner_ty, mutbl : mutbl } ;
377
389
let region = self . next_region_var ( infer:: PatternRegion ( pat. span ) ) ;
378
390
let rptr_ty = tcx. mk_ref ( region, mt) ;
@@ -685,7 +697,10 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
685
697
// arm for inconsistent arms or to the whole match when a `()` type
686
698
// is required).
687
699
Expectation :: ExpectHasType ( ety) if ety != self . tcx . mk_unit ( ) => ety,
688
- _ => self . next_ty_var ( TypeVariableOrigin :: MiscVariable ( expr. span ) ) ,
700
+ _ => self . next_ty_var ( TypeVariableOrigin {
701
+ kind : TypeVariableOriginKind :: MiscVariable ,
702
+ span : expr. span ,
703
+ } ) ,
689
704
} ;
690
705
CoerceMany :: with_coercion_sites ( coerce_first, arms)
691
706
} ;
0 commit comments