]> git.lizzy.rs Git - rust.git/commitdiff
put back macro redirect
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 9 Feb 2019 00:07:38 +0000 (01:07 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 9 Feb 2019 13:29:03 +0000 (14:29 +0100)
src/librustdoc/html/render.rs
src/test/rustdoc/without-redirect.rs

index ecc5bcff12dbac2edc32dce4ce7b042a7023762f..105bf611282f7dc81040e171fbf4de83fdaeb581 100644 (file)
@@ -2245,6 +2245,15 @@ fn item<F>(&mut self, item: clean::Item, all: &mut AllTypes, mut f: F) -> Result
                         try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
                     }
                 }
+                // If the item is a macro, redirect from the old macro URL (with !)
+                // to the new one (without).
+                if item_type == ItemType::Macro {
+                    let redir_name = format!("{}.{}!.html", item_type, name);
+                    let redir_dst = self.dst.join(redir_name);
+                    let redirect_out = try_err!(File::create(&redir_dst), &redir_dst);
+                    let mut redirect_out = BufWriter::new(redirect_out);
+                    try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
+                }
             }
         }
         Ok(())
index d473dd8f428d2ed8af71d6dd496f0e76243dcfe0..a076f8a3c5ec799a319797deec73ca4ec208fa98 100644 (file)
@@ -1,7 +1,7 @@
 #![crate_name = "foo"]
 
 // @has foo/macro.bar.html
-// @!has foo/macro.bar!.html
+// @has foo/macro.bar!.html
 // @!has foo/bar.m.html
 #[macro_export]
 macro_rules! bar {