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