rustdoc: fix doctests with non-feature crate attrs
This commit is contained in:
parent
28d6623bcc
commit
ec356bb1a7
5 changed files with 117 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue