about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-11-19 23:58:39 +0100
committerGitHub <noreply@github.com>2020-11-19 23:58:39 +0100
commit192ed76cb98a06a18c880604d97d36e25f42e5ae (patch)
tree4d1fc0a52cbbd30cefbd92dc9ecef9ddeea18b75 /src/test
parentacc2e2390114620ba57ea2f80412f7143c903bac (diff)
parentae644a2d4df673f5063d5b127488b7f03fef15a6 (diff)
downloadrust-192ed76cb98a06a18c880604d97d36e25f42e5ae.tar.gz
rust-192ed76cb98a06a18c880604d97d36e25f42e5ae.zip
Rollup merge of #79181 - aDotInTheVoid:provided-method-source-link, r=jyn514,GuillaumeGomez
rustdoc: add [src] links to methods on a trait's page

Closes #45150

![image](https://user-images.githubusercontent.com/28781354/99565541-aba4d500-29c3-11eb-99c7-11c1f91584e9.png)

### Caveats

- The way I've implemented it, links are also provided for required methods, that just link to the signature in the code. I'm not sure if this is the desired behaviour.

![image](https://user-images.githubusercontent.com/28781354/99566222-849ad300-29c4-11eb-9897-08cc5842954f.png)

- I'm not sure if the css changes are correct. I inspected them visualy on firefox on desktop, and they seem to be fine.
- I can't tell how `src/librustdoc/html/render/mod.rs` is structured, so I probably
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/trait-src-link.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/rustdoc/trait-src-link.rs b/src/test/rustdoc/trait-src-link.rs
new file mode 100644
index 00000000000..77116695690
--- /dev/null
+++ b/src/test/rustdoc/trait-src-link.rs
@@ -0,0 +1,26 @@
+#![crate_name = "quix"]
+pub trait Foo {
+    // @has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#4"]' '[src]'
+    fn required();
+
+    // @has quix/trait.Foo.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' '[src]'
+    fn provided() {}
+}
+
+pub struct Bar;
+
+impl Foo for Bar {
+    // @has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#14"]' '[src]'
+    fn required() {}
+    // @has quix/struct.Bar.html '//a[@href="../src/quix/trait-src-link.rs.html#7"]' '[src]'
+}
+
+pub struct Baz;
+
+impl Foo for Baz {
+    // @has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#22"]' '[src]'
+    fn required() {}
+
+    // @has quix/struct.Baz.html '//a[@href="../src/quix/trait-src-link.rs.html#25"]' '[src]'
+    fn provided() {}
+}