Skip to content

Commit

Permalink
Redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Aug 18, 2016
1 parent e6cc4c5 commit 301401e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/librustdoc/html/render.rs
Expand Up @@ -1426,6 +1426,16 @@ impl Context {
.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(())
Expand Down
2 changes: 2 additions & 0 deletions src/test/rustdoc/macros.rs
Expand Up @@ -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 {
() => [];
Expand Down

0 comments on commit 301401e

Please sign in to comment.