]> git.lizzy.rs Git - rust.git/commitdiff
Redirect
authorNick Cameron <ncameron@mozilla.com>
Tue, 16 Aug 2016 02:25:12 +0000 (14:25 +1200)
committerNick Cameron <ncameron@mozilla.com>
Thu, 18 Aug 2016 20:20:06 +0000 (08:20 +1200)
src/librustdoc/html/render.rs
src/test/rustdoc/macros.rs

index d654429146d83738d9a39888cbe785f0592c84d0..e02cfb96dddf17a0170f61008e82455f03480f4a 100644 (file)
@@ -1426,6 +1426,16 @@ fn item<F>(&mut self, item: clean::Item, mut f: F) -> Result<(), Error> where
                                                                 .open(&redir_dst) {
                     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).
+                // FIXME(#35705) remove this redirect.
+                if item_type == ItemType::Macro {
+                    let redir_name = format!("{}.{}!.html", item_type, name);
+                    let redir_dst = self.dst.join(redir_name);
+                    let mut redirect_out = try_err!(File::create(&redir_dst), &redir_dst);
+                    try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
+                }
             }
         }
         Ok(())
index f4115d8229a54df79842fa1f7e9c05a8fa89fbb7..9aeeb71707c905f4cbe3094751adbd480ee7c92e 100644 (file)
@@ -12,6 +12,8 @@
 // @has - //pre '() => { ... };'
 // @has - //pre '($a:tt) => { ... };'
 // @has - //pre '($e:expr) => { ... };'
+// @has macros/macro.my_macro!.html
+// @has - //a 'macro.my_macro.html'
 #[macro_export]
 macro_rules! my_macro {
     () => [];