rustdoc: fix doctests with non-feature crate attrs

This commit is contained in:
Alex Burka 2016-12-04 19:07:27 +00:00
parent 28d6623bcc
commit ec356bb1a7
5 changed files with 117 additions and 6 deletions

View file

@ -344,6 +344,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, dont_insert_main: bool,
prog
}
// FIXME(aburka): use a real parser to deal with multiline attributes
fn partition_source(s: &str) -> (String, String) {
use rustc_unicode::str::UnicodeStr;
@ -354,7 +355,7 @@ fn partition_source(s: &str) -> (String, String) {
for line in s.lines() {
let trimline = line.trim();
let header = trimline.is_whitespace() ||
trimline.starts_with("#![feature");
trimline.starts_with("#![");
if !header || after_header {
after_header = true;
after.push_str(line);