@@ -66,7 +66,6 @@ use rustc::hir;
6666use rustc:: hir:: def_id:: DefId ;
6767use rustc:: infer:: { Coercion , InferResult , InferOk } ;
6868use rustc:: infer:: type_variable:: TypeVariableOrigin ;
69- use rustc:: lint;
7069use rustc:: traits:: { self , ObligationCause , ObligationCauseCode } ;
7170use rustc:: ty:: adjustment:: { Adjustment , Adjust , AutoBorrow } ;
7271use rustc:: ty:: { self , TypeAndMut , Ty , ClosureSubsts } ;
@@ -736,27 +735,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
736735 pub fn try_coerce ( & self ,
737736 expr : & hir:: Expr ,
738737 expr_ty : Ty < ' tcx > ,
739- expr_diverges : Diverges ,
740738 target : Ty < ' tcx > )
741739 -> RelateResult < ' tcx , Ty < ' tcx > > {
742740 let source = self . resolve_type_vars_with_obligations ( expr_ty) ;
743741 debug ! ( "coercion::try({:?}: {:?} -> {:?})" , expr, source, target) ;
744742
745- // Special-ish case: we can coerce any type `T` into the `!`
746- // type, but only if the source expression diverges.
747- if target. is_never ( ) && expr_diverges. always ( ) {
748- debug ! ( "permit coercion to `!` because expr diverges" ) ;
749- if self . can_eq ( self . param_env , source, target) . is_err ( ) {
750- self . tcx . lint_node (
751- lint:: builtin:: COERCE_NEVER ,
752- expr. id ,
753- expr. span ,
754- & format ! ( "cannot coerce `{}` to !" , source)
755- ) ;
756- return Ok ( target) ;
757- }
758- }
759-
760743 let cause = self . cause ( expr. span , ObligationCauseCode :: ExprAssignable ) ;
761744 let coerce = Coerce :: new ( self , cause) ;
762745 let ok = self . commit_if_ok ( |_| coerce. coerce ( source, target) ) ?;
@@ -1106,7 +1089,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
11061089 if self . pushed == 0 {
11071090 // Special-case the first expression we are coercing.
11081091 // To be honest, I'm not entirely sure why we do this.
1109- fcx. try_coerce ( expression, expression_ty, expression_diverges , self . expected_ty )
1092+ fcx. try_coerce ( expression, expression_ty, self . expected_ty )
11101093 } else {
11111094 match self . expressions {
11121095 Expressions :: Dynamic ( ref exprs) =>
0 commit comments