@@ -194,6 +194,12 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
194
194
. emit ( ) ;
195
195
return ;
196
196
}
197
+ if !generics. where_clause . predicates . is_empty ( ) {
198
+ struct_span_err ! ( tcx. sess, main_span, E0646 ,
199
+ "main function is not allowed to have a where clause" )
200
+ . emit ( ) ;
201
+ return ;
202
+ }
197
203
}
198
204
_ => ( )
199
205
}
@@ -245,14 +251,21 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
245
251
match tcx. hir . find ( start_id) {
246
252
Some ( hir_map:: NodeItem ( it) ) => {
247
253
match it. node {
248
- hir:: ItemFn ( .., ref ps, _)
249
- if !ps. params . is_empty ( ) => {
250
- struct_span_err ! ( tcx. sess, ps. span, E0132 ,
251
- "start function is not allowed to have type parameters" )
252
- . span_label ( ps. span ,
253
- "start function cannot have type parameters" )
254
- . emit ( ) ;
255
- return ;
254
+ hir:: ItemFn ( .., ref ps, _) => {
255
+ if !ps. params . is_empty ( ) {
256
+ struct_span_err ! ( tcx. sess, ps. span, E0132 ,
257
+ "start function is not allowed to have type parameters" )
258
+ . span_label ( ps. span ,
259
+ "start function cannot have type parameters" )
260
+ . emit ( ) ;
261
+ return ;
262
+ }
263
+ if !ps. where_clause . predicates . is_empty ( ) {
264
+ struct_span_err ! ( tcx. sess, start_span, E0647 ,
265
+ "start function is not allowed to have a where clause" )
266
+ . emit ( ) ;
267
+ return ;
268
+ }
256
269
}
257
270
_ => ( )
258
271
}
0 commit comments