about summary refs log tree commit diff
path: root/src/test/rustdoc/intra-doc/proc-macro.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-03-17 11:41:01 -0700
committerMichael Howell <michael@notriddle.com>2021-04-17 09:21:52 -0700
commit6516f9408ef47137e070c2635b9f4a67d848f129 (patch)
tree05ffb4e6bcbddf1048d40471d7a560eb907fd27d /src/test/rustdoc/intra-doc/proc-macro.rs
parent03301ef1d8028dff1b07766dff14bfcafb309a85 (diff)
downloadrust-6516f9408ef47137e070c2635b9f4a67d848f129.tar.gz
rust-6516f9408ef47137e070c2635b9f4a67d848f129.zip
rustdoc: use more precise relative URLS
Instead of using a depth counter and adding "../" to get to the top,
this commit makes rustdoc actually compare the path of what it's
linking from to the path that it's linking to. This makes the resulting
HTML shorter.

Here's a comparison of one of the largest (non-source) files in the
Rust standard library docs (about 4% improvement before gzipping).

    $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html
    2387389 struct.Wrapping.old.html
    2298538 struct.Wrapping.new.html

Most if it can be efficiently gzipped away.

    $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz
    70679 struct.Wrapping.old.html.gz
    70050 struct.Wrapping.new.html.gz

But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
Diffstat (limited to 'src/test/rustdoc/intra-doc/proc-macro.rs')
-rw-r--r--src/test/rustdoc/intra-doc/proc-macro.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/rustdoc/intra-doc/proc-macro.rs b/src/test/rustdoc/intra-doc/proc-macro.rs
index ab4626ccfc3..fce10a130be 100644
--- a/src/test/rustdoc/intra-doc/proc-macro.rs
+++ b/src/test/rustdoc/intra-doc/proc-macro.rs
@@ -9,17 +9,17 @@ pub use proc_macro_macro::{DeriveA, attr_a};
 use proc_macro_macro::{DeriveB, attr_b};
 
 // @has proc_macro/struct.Foo.html
-// @has - '//a/@href' '../proc_macro/derive.DeriveA.html'
-// @has - '//a/@href' '../proc_macro/attr.attr_a.html'
-// @has - '//a/@href' '../proc_macro/trait.DeriveTrait.html'
+// @has - '//a/@href' 'derive.DeriveA.html'
+// @has - '//a/@href' 'attr.attr_a.html'
+// @has - '//a/@href' 'trait.DeriveTrait.html'
 // @has - '//a/@href' '../proc_macro_macro/derive.DeriveB.html'
 // @has - '//a/@href' '../proc_macro_macro/attr.attr_b.html'
 /// Link to [DeriveA], [attr_a], [DeriveB], [attr_b], [DeriveTrait]
 pub struct Foo;
 
 // @has proc_macro/struct.Bar.html
-// @has - '//a/@href' '../proc_macro/derive.DeriveA.html'
-// @has - '//a/@href' '../proc_macro/attr.attr_a.html'
+// @has - '//a/@href' 'derive.DeriveA.html'
+// @has - '//a/@href' 'attr.attr_a.html'
 /// Link to [deriveA](derive@DeriveA) [attr](macro@attr_a)
 pub struct Bar;