Update restrictions on rustdoc source rendering

The std macros used to be injected with a filename of "<std-macros>", but macros
are now injected with a filename of "<{} macros>" where `{}` is filled in with
the crate name. This updates rustdoc to understand this new system so it'll
render source more frequently.
This commit is contained in:
Alex Crichton 2014-02-14 13:11:36 -08:00
parent 92c5738aae
commit 1bf1eeac6e

View File

@ -418,8 +418,10 @@ impl<'a> SourceCollector<'a> {
// can't have the source to it anyway.
let contents = match File::open(&p).read_to_end() {
Ok(r) => r,
// eew macro hacks
Err(..) if filename == "<std-macros>" => return Ok(()),
// macros from other libraries get special filenames which we can
// safely ignore
Err(..) if filename.starts_with("<") &&
filename.ends_with("macros>") => return Ok(()),
Err(e) => return Err(e)
};
let contents = str::from_utf8_owned(contents).unwrap();