@@ -53,7 +53,6 @@ use std::mem;
53
53
use std:: rc:: Rc ;
54
54
use syntax:: abi:: Abi ;
55
55
use hir;
56
- use lint;
57
56
use util:: nodemap:: { FxHashMap , FxHashSet } ;
58
57
59
58
@@ -526,54 +525,12 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
526
525
debug ! ( "select({:?})" , obligation) ;
527
526
assert ! ( !obligation. predicate. has_escaping_regions( ) ) ;
528
527
529
- let tcx = self . tcx ( ) ;
530
-
531
528
let stack = self . push_stack ( TraitObligationStackList :: empty ( ) , obligation) ;
532
529
let ret = match self . candidate_from_obligation ( & stack) ? {
533
530
None => None ,
534
531
Some ( candidate) => Some ( self . confirm_candidate ( obligation, candidate) ?)
535
532
} ;
536
533
537
- // Test whether this is a `()` which was produced by defaulting a
538
- // diverging type variable with `!` disabled. If so, we may need
539
- // to raise a warning.
540
- if obligation. predicate . skip_binder ( ) . self_ty ( ) . is_defaulted_unit ( ) {
541
- let mut raise_warning = true ;
542
- // Don't raise a warning if the trait is implemented for ! and only
543
- // permits a trivial implementation for !. This stops us warning
544
- // about (for example) `(): Clone` becoming `!: Clone` because such
545
- // a switch can't cause code to stop compiling or execute
546
- // differently.
547
- let mut never_obligation = obligation. clone ( ) ;
548
- let def_id = never_obligation. predicate . skip_binder ( ) . trait_ref . def_id ;
549
- never_obligation. predicate = never_obligation. predicate . map_bound ( |mut trait_pred| {
550
- // Swap out () with ! so we can check if the trait is impld for !
551
- {
552
- let trait_ref = & mut trait_pred. trait_ref ;
553
- let unit_substs = trait_ref. substs ;
554
- let mut never_substs = Vec :: with_capacity ( unit_substs. len ( ) ) ;
555
- never_substs. push ( tcx. types . never . into ( ) ) ;
556
- never_substs. extend ( & unit_substs[ 1 ..] ) ;
557
- trait_ref. substs = tcx. intern_substs ( & never_substs) ;
558
- }
559
- trait_pred
560
- } ) ;
561
- if let Ok ( Some ( ..) ) = self . select ( & never_obligation) {
562
- if !tcx. trait_relevant_for_never ( def_id) {
563
- // The trait is also implemented for ! and the resulting
564
- // implementation cannot actually be invoked in any way.
565
- raise_warning = false ;
566
- }
567
- }
568
-
569
- if raise_warning {
570
- tcx. lint_node ( lint:: builtin:: RESOLVE_TRAIT_ON_DEFAULTED_UNIT ,
571
- obligation. cause . body_id ,
572
- obligation. cause . span ,
573
- & format ! ( "code relies on type inference rules which are likely \
574
- to change") ) ;
575
- }
576
- }
577
534
Ok ( ret)
578
535
}
579
536
@@ -1929,7 +1886,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1929
1886
}
1930
1887
1931
1888
// (.., T) -> (.., U).
1932
- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
1889
+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
1933
1890
tys_a. len ( ) == tys_b. len ( )
1934
1891
}
1935
1892
@@ -2068,7 +2025,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2068
2025
2069
2026
ty:: TyStr | ty:: TySlice ( _) | ty:: TyDynamic ( ..) | ty:: TyForeign ( ..) => Never ,
2070
2027
2071
- ty:: TyTuple ( tys, _ ) => {
2028
+ ty:: TyTuple ( tys) => {
2072
2029
Where ( ty:: Binder ( tys. last ( ) . into_iter ( ) . cloned ( ) . collect ( ) ) )
2073
2030
}
2074
2031
@@ -2122,7 +2079,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2122
2079
Where ( ty:: Binder ( vec ! [ element_ty] ) )
2123
2080
}
2124
2081
2125
- ty:: TyTuple ( tys, _ ) => {
2082
+ ty:: TyTuple ( tys) => {
2126
2083
// (*) binder moved here
2127
2084
Where ( ty:: Binder ( tys. to_vec ( ) ) )
2128
2085
}
@@ -2215,7 +2172,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
2215
2172
vec ! [ element_ty]
2216
2173
}
2217
2174
2218
- ty:: TyTuple ( ref tys, _ ) => {
2175
+ ty:: TyTuple ( ref tys) => {
2219
2176
// (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
2220
2177
tys. to_vec ( )
2221
2178
}
@@ -3004,7 +2961,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
3004
2961
}
3005
2962
3006
2963
// (.., T) -> (.., U).
3007
- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
2964
+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
3008
2965
assert_eq ! ( tys_a. len( ) , tys_b. len( ) ) ;
3009
2966
3010
2967
// The last field of the tuple has to exist.
@@ -3017,7 +2974,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
3017
2974
3018
2975
// Check that the source tuple with the target's
3019
2976
// last element is equal to the target.
3020
- let new_tuple = tcx. mk_tup ( a_mid. iter ( ) . chain ( Some ( b_last) ) , false ) ;
2977
+ let new_tuple = tcx. mk_tup ( a_mid. iter ( ) . chain ( Some ( b_last) ) ) ;
3021
2978
let InferOk { obligations, .. } =
3022
2979
self . infcx . at ( & obligation. cause , obligation. param_env )
3023
2980
. eq ( target, new_tuple)
0 commit comments