Skip to content

Commit 1bf1eea

Browse files
committed
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.
1 parent 92c5738 commit 1bf1eea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustdoc/html/render.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,10 @@ impl<'a> SourceCollector<'a> {
418418
// can't have the source to it anyway.
419419
let contents = match File::open(&p).read_to_end() {
420420
Ok(r) => r,
421-
// eew macro hacks
422-
Err(..) if filename == "<std-macros>" => return Ok(()),
421+
// macros from other libraries get special filenames which we can
422+
// safely ignore
423+
Err(..) if filename.starts_with("<") &&
424+
filename.ends_with("macros>") => return Ok(()),
423425
Err(e) => return Err(e)
424426
};
425427
let contents = str::from_utf8_owned(contents).unwrap();

0 commit comments

Comments
 (0)