@@ -52,7 +52,6 @@ use std::mem;
5252use std:: rc:: Rc ;
5353use syntax:: abi:: Abi ;
5454use hir;
55- use lint;
5655use util:: nodemap:: FxHashMap ;
5756
5857struct InferredObligationsSnapshotVecDelegate < ' tcx > {
@@ -517,8 +516,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
517516 debug ! ( "select({:?})" , obligation) ;
518517 assert ! ( !obligation. predicate. has_escaping_regions( ) ) ;
519518
520- let tcx = self . tcx ( ) ;
521-
522519 let stack = self . push_stack ( TraitObligationStackList :: empty ( ) , obligation) ;
523520 let ret = match self . candidate_from_obligation ( & stack) ? {
524521 None => None ,
@@ -530,46 +527,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
530527 } ,
531528 } ;
532529
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- }
573530 Ok ( ret)
574531 }
575532
@@ -1913,7 +1870,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
19131870 }
19141871
19151872 // (.., T) -> (.., U).
1916- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
1873+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
19171874 tys_a. len ( ) == tys_b. len ( )
19181875 }
19191876
@@ -2052,7 +2009,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
20522009
20532010 ty:: TyStr | ty:: TySlice ( _) | ty:: TyDynamic ( ..) | ty:: TyForeign ( ..) => Never ,
20542011
2055- ty:: TyTuple ( tys, _ ) => {
2012+ ty:: TyTuple ( tys) => {
20562013 Where ( ty:: Binder ( tys. last ( ) . into_iter ( ) . cloned ( ) . collect ( ) ) )
20572014 }
20582015
@@ -2105,7 +2062,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21052062 Where ( ty:: Binder ( vec ! [ element_ty] ) )
21062063 }
21072064
2108- ty:: TyTuple ( tys, _ ) => {
2065+ ty:: TyTuple ( tys) => {
21092066 // (*) binder moved here
21102067 Where ( ty:: Binder ( tys. to_vec ( ) ) )
21112068 }
@@ -2196,7 +2153,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21962153 vec ! [ element_ty]
21972154 }
21982155
2199- ty:: TyTuple ( ref tys, _ ) => {
2156+ ty:: TyTuple ( ref tys) => {
22002157 // (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
22012158 tys. to_vec ( )
22022159 }
@@ -2969,7 +2926,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
29692926 }
29702927
29712928 // (.., T) -> (.., U).
2972- ( & ty:: TyTuple ( tys_a, _ ) , & ty:: TyTuple ( tys_b, _ ) ) => {
2929+ ( & ty:: TyTuple ( tys_a) , & ty:: TyTuple ( tys_b) ) => {
29732930 assert_eq ! ( tys_a. len( ) , tys_b. len( ) ) ;
29742931
29752932 // The last field of the tuple has to exist.
@@ -2982,7 +2939,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
29822939
29832940 // Check that the source tuple with the target's
29842941 // 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) ) ) ;
29862943 let InferOk { obligations, .. } =
29872944 self . infcx . at ( & obligation. cause , obligation. param_env )
29882945 . eq ( target, new_tuple)
0 commit comments