about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-14 17:51:29 -0800
committerbors <bors@rust-lang.org>2014-02-14 17:51:29 -0800
commit9b173edf863c3f04a0d8534bdd3e3cbef31c711a (patch)
treec3e436dbfc89d3a162d95326971130dc3c924747
parentd365c3a6e6eea2079ce758208fd5e71cad299377 (diff)
parent1bf1eeac6e15a5cb3d84d94e8db5ab376e5a0186 (diff)
downloadrust-9b173edf863c3f04a0d8534bdd3e3cbef31c711a.tar.gz
rust-9b173edf863c3f04a0d8534bdd3e3cbef31c711a.zip
auto merge of #12277 : alexcrichton/rust/fix-rustdoc-render, r=huonw
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.
-rw-r--r--src/librustdoc/html/render.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 29773c60a87..10b22877936 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -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();