@@ -1130,25 +1130,23 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
1130
1130
}
1131
1131
fcx. demand_suptype ( span, ret_ty, actual_return_ty) ;
1132
1132
1133
- if fcx. tcx . features ( ) . termination_trait {
1134
- // If the termination trait language item is activated, check that the main return type
1135
- // implements the termination trait.
1136
- if let Some ( term_id) = fcx. tcx . lang_items ( ) . termination ( ) {
1137
- if let Some ( ( id, _) ) = * fcx. tcx . sess . entry_fn . borrow ( ) {
1138
- if id == fn_id {
1139
- match fcx. sess ( ) . entry_type . get ( ) {
1140
- Some ( config:: EntryMain ) => {
1141
- let substs = fcx. tcx . mk_substs ( iter:: once ( Kind :: from ( ret_ty) ) ) ;
1142
- let trait_ref = ty:: TraitRef :: new ( term_id, substs) ;
1143
- let cause = traits:: ObligationCause :: new (
1144
- span, fn_id, ObligationCauseCode :: MainFunctionType ) ;
1145
-
1146
- inherited. register_predicate (
1147
- traits:: Obligation :: new (
1148
- cause, param_env, trait_ref. to_predicate ( ) ) ) ;
1149
- } ,
1150
- _ => { } ,
1151
- }
1133
+ // Check that the main return type implements the termination trait.
1134
+ if let Some ( term_id) = fcx. tcx . lang_items ( ) . termination ( ) {
1135
+ if let Some ( ( id, _) ) = * fcx. tcx . sess . entry_fn . borrow ( ) {
1136
+ if id == fn_id {
1137
+ match fcx. sess ( ) . entry_type . get ( ) {
1138
+ Some ( config:: EntryMain ) => {
1139
+ let substs = fcx. tcx . mk_substs ( iter:: once ( Kind :: from ( ret_ty) ) ) ;
1140
+ let trait_ref = ty:: TraitRef :: new ( term_id, substs) ;
1141
+ let return_ty_span = decl. output . span ( ) ;
1142
+ let cause = traits:: ObligationCause :: new (
1143
+ return_ty_span, fn_id, ObligationCauseCode :: MainFunctionType ) ;
1144
+
1145
+ inherited. register_predicate (
1146
+ traits:: Obligation :: new (
1147
+ cause, param_env, trait_ref. to_predicate ( ) ) ) ;
1148
+ } ,
1149
+ _ => { } ,
1152
1150
}
1153
1151
}
1154
1152
}
0 commit comments