Skip to content

Update restrictions on rustdoc source rendering #12277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
alexcrichton committed Feb 14, 2014
commit 1bf1eeac6e15a5cb3d84d94e8db5ab376e5a0186
6 changes: 4 additions & 2 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down