diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 8a29155d12d5b..c1e6b4f5a17d9 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -325,6 +325,8 @@ Erroneous code example: extern crate core; struct core; + +fn main() {} ``` There are two possible solutions: diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 08258489a2ec2..f811eea0f8771 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -417,7 +417,8 @@ fn partition_source(s: &str) -> (String, String) { for line in s.lines() { let trimline = line.trim(); let header = trimline.is_whitespace() || - trimline.starts_with("#!["); + trimline.starts_with("#![") || + trimline.starts_with("extern crate"); if !header || after_header { after_header = true; after.push_str(line); @@ -858,8 +859,8 @@ use asdf::qwop; assert_eq!(2+2, 4);"; let expected = "#![allow(unused)] -fn main() { extern crate asdf; +fn main() { use asdf::qwop; assert_eq!(2+2, 4); }".to_string();