@@ -407,7 +407,7 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
407407 push_to_s ( & mut info. crate_attrs , source, attr. span , & mut prev_span_hi) ;
408408 }
409409 }
410- let mut has_non_module_items = false ;
410+ let mut has_non_items = false ;
411411 for stmt in & body. stmts {
412412 let mut is_extern_crate = false ;
413413 match stmt. kind {
@@ -419,8 +419,11 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
419419 reset_error_count ( & psess) ;
420420 return Err ( ( ) ) ;
421421 }
422- has_non_module_items = true ;
422+ has_non_items = true ;
423423 }
424+ // We assume that the macro calls will expand to item(s) even though they could
425+ // expand to statements and expressions. And the simple fact that we're trying
426+ // to retrieve a `main` function inside it is a terrible idea.
424427 StmtKind :: MacCall ( ref mac_call) if !info. has_main_fn => {
425428 let mut iter = mac_call. mac . args . tokens . iter ( ) ;
426429
@@ -444,7 +447,7 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
444447 // We do nothing in this case. Not marking it as `non_module_items` either.
445448 StmtKind :: Empty => { }
446449 _ => {
447- has_non_module_items = true ;
450+ has_non_items = true ;
448451 }
449452 }
450453
@@ -470,7 +473,7 @@ fn parse_source(source: &str, crate_name: &Option<&str>) -> Result<ParseSourceIn
470473 push_to_s ( & mut info. crates , source, span, & mut prev_span_hi) ;
471474 }
472475 }
473- if has_non_module_items {
476+ if has_non_items {
474477 // FIXME: if `info.has_main_fn` is `true`, emit a warning here to mention that
475478 // this code will not be called.
476479 info. has_main_fn = false ;
0 commit comments