Skip to content

Commit d264755

Browse files
put back macro redirect
1 parent 397eb4f commit d264755

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/librustdoc/html/render.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,15 @@ impl Context {
22452245
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
22462246
}
22472247
}
2248+
// If the item is a macro, redirect from the old macro URL (with !)
2249+
// to the new one (without).
2250+
if item_type == ItemType::Macro {
2251+
let redir_name = format!("{}.{}!.html", item_type, name);
2252+
let redir_dst = self.dst.join(redir_name);
2253+
let redirect_out = try_err!(File::create(&redir_dst), &redir_dst);
2254+
let mut redirect_out = BufWriter::new(redirect_out);
2255+
try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst);
2256+
}
22482257
}
22492258
}
22502259
Ok(())

src/test/rustdoc/without-redirect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![crate_name = "foo"]
22

33
// @has foo/macro.bar.html
4-
// @!has foo/macro.bar!.html
4+
// @has foo/macro.bar!.html
55
// @!has foo/bar.m.html
66
#[macro_export]
77
macro_rules! bar {

0 commit comments

Comments
 (0)