@@ -1106,25 +1106,22 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
1106
1106
}
1107
1107
fcx. demand_suptype ( span, ret_ty, actual_return_ty) ;
1108
1108
1109
- if fcx. tcx . features ( ) . termination_trait {
1110
- // If the termination trait language item is activated, check that the main return type
1111
- // implements the termination trait.
1112
- if let Some ( term_id) = fcx. tcx . lang_items ( ) . termination ( ) {
1113
- if let Some ( ( id, _) ) = * fcx. tcx . sess . entry_fn . borrow ( ) {
1114
- if id == fn_id {
1115
- match fcx. sess ( ) . entry_type . get ( ) {
1116
- Some ( config:: EntryMain ) => {
1117
- let substs = fcx. tcx . mk_substs ( iter:: once ( Kind :: from ( ret_ty) ) ) ;
1118
- let trait_ref = ty:: TraitRef :: new ( term_id, substs) ;
1119
- let cause = traits:: ObligationCause :: new (
1120
- span, fn_id, ObligationCauseCode :: MainFunctionType ) ;
1121
-
1122
- inherited. register_predicate (
1123
- traits:: Obligation :: new (
1124
- cause, param_env, trait_ref. to_predicate ( ) ) ) ;
1125
- } ,
1126
- _ => { } ,
1127
- }
1109
+ // Check that the main return type implements the termination trait.
1110
+ if let Some ( term_id) = fcx. tcx . lang_items ( ) . termination ( ) {
1111
+ if let Some ( ( id, _) ) = * fcx. tcx . sess . entry_fn . borrow ( ) {
1112
+ if id == fn_id {
1113
+ match fcx. sess ( ) . entry_type . get ( ) {
1114
+ Some ( config:: EntryMain ) => {
1115
+ let substs = fcx. tcx . mk_substs ( iter:: once ( Kind :: from ( ret_ty) ) ) ;
1116
+ let trait_ref = ty:: TraitRef :: new ( term_id, substs) ;
1117
+ let cause = traits:: ObligationCause :: new (
1118
+ span, fn_id, ObligationCauseCode :: MainFunctionType ) ;
1119
+
1120
+ inherited. register_predicate (
1121
+ traits:: Obligation :: new (
1122
+ cause, param_env, trait_ref. to_predicate ( ) ) ) ;
1123
+ } ,
1124
+ _ => { } ,
1128
1125
}
1129
1126
}
1130
1127
}
0 commit comments