@@ -1359,7 +1359,8 @@ fn ty_of_method_or_bare_fn<'a, 'tcx>(this: &AstConv<'tcx>,
13591359 implied_output_region,
13601360 lifetimes_for_params,
13611361 & * * output) ) ,
1362- ast:: NoReturn ( _) => ty:: FnDiverging
1362+ ast:: DefaultReturn ( ..) => ty:: FnConverging ( ty:: mk_nil ( this. tcx ( ) ) ) ,
1363+ ast:: NoReturn ( ..) => ty:: FnDiverging
13631364 } ;
13641365
13651366 ( ty:: BareFnTy {
@@ -1486,14 +1487,21 @@ pub fn ty_of_closure<'tcx>(
14861487
14871488 let expected_ret_ty = expected_sig. map ( |e| e. output ) ;
14881489
1490+ let is_infer = match decl. output {
1491+ ast:: Return ( ref output) if output. node == ast:: TyInfer => true ,
1492+ ast:: DefaultReturn ( ..) => true ,
1493+ _ => false
1494+ } ;
1495+
14891496 let output_ty = match decl. output {
1490- ast :: Return ( ref output ) if output . node == ast :: TyInfer && expected_ret_ty. is_some ( ) =>
1497+ _ if is_infer && expected_ret_ty. is_some ( ) =>
14911498 expected_ret_ty. unwrap ( ) ,
1492- ast :: Return ( ref output ) if output . node == ast :: TyInfer =>
1493- ty:: FnConverging ( this. ty_infer ( output. span ) ) ,
1499+ _ if is_infer =>
1500+ ty:: FnConverging ( this. ty_infer ( decl . output . span ( ) ) ) ,
14941501 ast:: Return ( ref output) =>
14951502 ty:: FnConverging ( ast_ty_to_ty ( this, & rb, & * * output) ) ,
1496- ast:: NoReturn ( _) => ty:: FnDiverging
1503+ ast:: DefaultReturn ( ..) => unreachable ! ( ) ,
1504+ ast:: NoReturn ( ..) => ty:: FnDiverging
14971505 } ;
14981506
14991507 debug ! ( "ty_of_closure: input_tys={}" , input_tys. repr( this. tcx( ) ) ) ;
0 commit comments