@@ -194,6 +194,12 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
194194 . emit ( ) ;
195195 return ;
196196 }
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+ }
197203 }
198204 _ => ( )
199205 }
@@ -245,14 +251,21 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
245251 match tcx. hir . find ( start_id) {
246252 Some ( hir_map:: NodeItem ( it) ) => {
247253 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+ }
256269 }
257270 _ => ( )
258271 }
0 commit comments