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