diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-02-09 01:07:38 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-02-09 14:29:03 +0100 |
| commit | d26475505b4c2bfc6299d3c6c38b1963c3bd86e0 (patch) | |
| tree | 47d799c7d95077ff59769a245c1a675806ea8934 | |
| parent | 397eb4f237b92f77eadf12c0bea7cfea5a31a92a (diff) | |
| download | rust-d26475505b4c2bfc6299d3c6c38b1963c3bd86e0.tar.gz rust-d26475505b4c2bfc6299d3c6c38b1963c3bd86e0.zip | |
put back macro redirect
| -rw-r--r-- | src/librustdoc/html/render.rs | 9 | ||||
| -rw-r--r-- | src/test/rustdoc/without-redirect.rs | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index ecc5bcff12d..105bf611282 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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(()) diff --git a/src/test/rustdoc/without-redirect.rs b/src/test/rustdoc/without-redirect.rs index d473dd8f428..a076f8a3c5e 100644 --- a/src/test/rustdoc/without-redirect.rs +++ b/src/test/rustdoc/without-redirect.rs @@ -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 { |
