Skip to content

Commit

Permalink
put back macro redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 9, 2019
1 parent 397eb4f commit d264755
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,15 @@ impl Context {
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(())
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/without-redirect.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit d264755

Please sign in to comment.