@@ -196,6 +196,12 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
196196 . emit ( ) ;
197197 return ;
198198 }
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+ }
199205 }
200206 _ => ( )
201207 }
@@ -247,14 +253,21 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
247253 match tcx. hir . find ( start_id) {
248254 Some ( hir_map:: NodeItem ( it) ) => {
249255 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+ }
258271 }
259272 _ => ( )
260273 }
0 commit comments