diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-11-19 23:58:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-19 23:58:39 +0100 |
| commit | 192ed76cb98a06a18c880604d97d36e25f42e5ae (patch) | |
| tree | 4d1fc0a52cbbd30cefbd92dc9ecef9ddeea18b75 /src/test | |
| parent | acc2e2390114620ba57ea2f80412f7143c903bac (diff) | |
| parent | ae644a2d4df673f5063d5b127488b7f03fef15a6 (diff) | |
| download | rust-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  ### 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.  - 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.rs | 26 |
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() {} +} |
