@@ -52,7 +52,6 @@ use std::mem;
52
52
use std:: rc:: Rc ;
53
53
use syntax:: abi:: Abi ;
54
54
use hir;
55
- use lint;
56
55
use util:: nodemap:: FxHashMap ;
57
56
58
57
struct InferredObligationsSnapshotVecDelegate < ' tcx > {
@@ -517,8 +516,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
517
516
debug ! ( "select({:?})" , obligation) ;
518
517
assert ! ( !obligation. predicate. has_escaping_regions( ) ) ;
519
518
520
- let tcx = self . tcx ( ) ;
521
-
522
519
let stack = self . push_stack ( TraitObligationStackList :: empty ( ) , obligation) ;
523
520
let ret = match self . candidate_from_obligation ( & stack) ? {
524
521
None => None ,
@@ -530,46 +527,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
530
527
} ,
531
528
} ;
532
529
533
- // Test whether this is a `()` which was produced by defaulting a
534
- // diverging type variable with `!` disabled. If so, we may need
535
- // to raise a warning.
536
- if obligation. predicate . skip_binder ( ) . self_ty ( ) . is_defaulted_unit ( ) {
537
- let mut raise_warning = true ;
538
- // Don't raise a warning if the trait is implemented for ! and only
539
- // permits a trivial implementation for !. This stops us warning
540
- // about (for example) `(): Clone` becoming `!: Clone` because such
541
- // a switch can't cause code to stop compiling or execute
542
- // differently.
543
- let mut never_obligation = obligation. clone ( ) ;
544
- let def_id = never_obligation. predicate . skip_binder ( ) . trait_ref . def_id ;
545
- never_obligation. predicate = never_obligation. predicate . map_bound ( |mut trait_pred| {
546
- // Swap out () with ! so we can check if the trait is impld for !
547
- {
548
- let trait_ref = & mut trait_pred. trait_ref ;
549
- let unit_substs = trait_ref. substs ;
550
- let mut never_substs = Vec :: with_capacity ( unit_substs. len ( ) ) ;
551
- never_substs. push ( From :: from ( tcx. types . never ) ) ;
552
- never_substs. extend ( & unit_substs[ 1 ..] ) ;
553
- trait_ref. substs = tcx. intern_substs ( & never_substs) ;
554
- }
555
- trait_pred
556
- } ) ;
557
- if let Ok ( Some ( ..) ) = self . select ( & never_obligation) {
558
- if !tcx. trait_relevant_for_never ( def_id) {
559
- // The trait is also implemented for ! and the resulting
560
- // implementation cannot actually be invoked in any way.
561
- raise_warning = false ;
562
- }
563
- }
564
-
565
- if raise_warning {
566
- tcx. lint_node ( lint:: builtin:: RESOLVE_TRAIT_ON_DEFAULTED_UNIT ,
567
- obligation. cause . body_id ,
568
- obligation. cause . span ,
569
- & format ! ( "code relies on type inference rules which are likely \
570
- to change") ) ;
571
- }
572
- }
573
530
Ok ( ret)
574
531
}
575
532
@@ -1913,7 +1870,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1913
1870
}
1914
1871
1915
1872
// (.., T) -> (.., U).
1916
- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
1873
+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
1917
1874
tys_a. len ( ) == tys_b. len ( )
1918
1875
}
1919
1876
@@ -2052,7 +2009,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2052
2009
2053
2010
ty:: TyStr | ty:: TySlice ( _) | ty:: TyDynamic ( ..) | ty:: TyForeign ( ..) => Never ,
2054
2011
2055
- ty:: TyTuple ( tys, _ ) => {
2012
+ ty:: TyTuple ( tys) => {
2056
2013
Where ( ty:: Binder ( tys. last ( ) . into_iter ( ) . cloned ( ) . collect ( ) ) )
2057
2014
}
2058
2015
@@ -2105,7 +2062,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2105
2062
Where ( ty:: Binder ( vec ! [ element_ty] ) )
2106
2063
}
2107
2064
2108
- ty:: TyTuple ( tys, _ ) => {
2065
+ ty:: TyTuple ( tys) => {
2109
2066
// (*) binder moved here
2110
2067
Where ( ty:: Binder ( tys. to_vec ( ) ) )
2111
2068
}
@@ -2196,7 +2153,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2196
2153
vec ! [ element_ty]
2197
2154
}
2198
2155
2199
- ty:: TyTuple ( ref tys, _ ) => {
2156
+ ty:: TyTuple ( ref tys) => {
2200
2157
// (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
2201
2158
tys. to_vec ( )
2202
2159
}
@@ -2969,7 +2926,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2969
2926
}
2970
2927
2971
2928
// (.., T) -> (.., U).
2972
- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
2929
+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
2973
2930
assert_eq ! ( tys_a. len( ) , tys_b. len( ) ) ;
2974
2931
2975
2932
// The last field of the tuple has to exist.
@@ -2982,7 +2939,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2982
2939
2983
2940
// Check that the source tuple with the target's
2984
2941
// last element is equal to the target.
2985
- let new_tuple = tcx. mk_tup ( a_mid. iter ( ) . chain ( Some ( b_last) ) , false ) ;
2942
+ let new_tuple = tcx. mk_tup ( a_mid. iter ( ) . chain ( Some ( b_last) ) ) ;
2986
2943
let InferOk { obligations, .. } =
2987
2944
self . infcx . at ( & obligation. cause , obligation. param_env )
2988
2945
. eq ( target, new_tuple)
0 commit comments