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:
parent
92c5738aae
commit
1bf1eeac6e
1 changed files with 4 additions and 2 deletions
|
@ -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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue