@@ -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 > {
@@ -533,8 +532,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
533
532
debug ! ( "select({:?})" , obligation) ;
534
533
assert ! ( !obligation. predicate. has_escaping_regions( ) ) ;
535
534
536
- let tcx = self . tcx ( ) ;
537
-
538
535
let stack = self . push_stack ( TraitObligationStackList :: empty ( ) , obligation) ;
539
536
let ret = match self . candidate_from_obligation ( & stack) ? {
540
537
None => None ,
@@ -546,46 +543,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
546
543
} ,
547
544
} ;
548
545
549
- // Test whether this is a `()` which was produced by defaulting a
550
- // diverging type variable with `!` disabled. If so, we may need
551
- // to raise a warning.
552
- if obligation. predicate . skip_binder ( ) . self_ty ( ) . is_defaulted_unit ( ) {
553
- let mut raise_warning = true ;
554
- // Don't raise a warning if the trait is implemented for ! and only
555
- // permits a trivial implementation for !. This stops us warning
556
- // about (for example) `(): Clone` becoming `!: Clone` because such
557
- // a switch can't cause code to stop compiling or execute
558
- // differently.
559
- let mut never_obligation = obligation. clone ( ) ;
560
- let def_id = never_obligation. predicate . skip_binder ( ) . trait_ref . def_id ;
561
- never_obligation. predicate = never_obligation. predicate . map_bound ( |mut trait_pred| {
562
- // Swap out () with ! so we can check if the trait is impld for !
563
- {
564
- let trait_ref = & mut trait_pred. trait_ref ;
565
- let unit_substs = trait_ref. substs ;
566
- let mut never_substs = Vec :: with_capacity ( unit_substs. len ( ) ) ;
567
- never_substs. push ( From :: from ( tcx. types . never ) ) ;
568
- never_substs. extend ( & unit_substs[ 1 ..] ) ;
569
- trait_ref. substs = tcx. intern_substs ( & never_substs) ;
570
- }
571
- trait_pred
572
- } ) ;
573
- if let Ok ( Some ( ..) ) = self . select ( & never_obligation) {
574
- if !tcx. trait_relevant_for_never ( def_id) {
575
- // The trait is also implemented for ! and the resulting
576
- // implementation cannot actually be invoked in any way.
577
- raise_warning = false ;
578
- }
579
- }
580
-
581
- if raise_warning {
582
- tcx. lint_node ( lint:: builtin:: RESOLVE_TRAIT_ON_DEFAULTED_UNIT ,
583
- obligation. cause . body_id ,
584
- obligation. cause . span ,
585
- & format ! ( "code relies on type inference rules which are likely \
586
- to change") ) ;
587
- }
588
- }
589
546
Ok ( ret)
590
547
}
591
548
@@ -1937,7 +1894,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1937
1894
}
1938
1895
1939
1896
// (.., T) -> (.., U).
1940
- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
1897
+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
1941
1898
tys_a. len ( ) == tys_b. len ( )
1942
1899
}
1943
1900
@@ -2076,7 +2033,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2076
2033
2077
2034
ty:: TyStr | ty:: TySlice ( _) | ty:: TyDynamic ( ..) | ty:: TyForeign ( ..) => Never ,
2078
2035
2079
- ty:: TyTuple ( tys, _ ) => {
2036
+ ty:: TyTuple ( tys) => {
2080
2037
Where ( ty:: Binder ( tys. last ( ) . into_iter ( ) . cloned ( ) . collect ( ) ) )
2081
2038
}
2082
2039
@@ -2129,7 +2086,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2129
2086
Where ( ty:: Binder ( vec ! [ element_ty] ) )
2130
2087
}
2131
2088
2132
- ty:: TyTuple ( tys, _ ) => {
2089
+ ty:: TyTuple ( tys) => {
2133
2090
// (*) binder moved here
2134
2091
Where ( ty:: Binder ( tys. to_vec ( ) ) )
2135
2092
}
@@ -2220,7 +2177,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2220
2177
vec ! [ element_ty]
2221
2178
}
2222
2179
2223
- ty:: TyTuple ( ref tys, _ ) => {
2180
+ ty:: TyTuple ( ref tys) => {
2224
2181
// (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
2225
2182
tys. to_vec ( )
2226
2183
}
@@ -2999,7 +2956,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2999
2956
}
3000
2957
3001
2958
// (.., T) -> (.., U).
3002
- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
2959
+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
3003
2960
assert_eq ! ( tys_a. len( ) , tys_b. len( ) ) ;
3004
2961
3005
2962
// The last field of the tuple has to exist.
@@ -3012,7 +2969,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
3012
2969
3013
2970
// Check that the source tuple with the target's
3014
2971
// last element is equal to the target.
3015
- let new_tuple = tcx. mk_tup ( a_mid. iter ( ) . chain ( Some ( b_last) ) , false ) ;
2972
+ let new_tuple = tcx. mk_tup ( a_mid. iter ( ) . chain ( Some ( b_last) ) ) ;
3016
2973
let InferOk { obligations, .. } =
3017
2974
self . infcx . at ( & obligation. cause , obligation. param_env )
3018
2975
. eq ( target, new_tuple)
0 commit comments