forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#87035 - GuillaumeGomez:fix-implementors-dis…
…play, r=notriddle Fix implementors display Part of rust-lang#86632. This PR does a few things: * It fixes of the JS rendered implementors. * It generates anchors for JS rendered implementors to make it coherent with the others. * It adds a test to ensure that we won't have the same issue again. * It changes the way we render the rustdoc-gui crates to simplify it a bit and also to allow to have dependencies without going through compiletest. Before: ![Screenshot from 2021-07-10 13-30-13](https://user-images.githubusercontent.com/3050060/125174172-b4048700-e1c3-11eb-8f0e-c46081371d4f.png) After: ![Screenshot from 2021-07-10 21-11-15](https://user-images.githubusercontent.com/3050060/125174173-b49d1d80-e1c3-11eb-8740-1dbbff70c2eb.png) I plan to add the `[src]` links in another PR because this one is already big enough. cc `@Mark-Simulacrum` (for the bootstrap changes) r? `@Nemo157`
- Loading branch information
Showing
13 changed files
with
109 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// The goal of this test is to check that the external trait implementors, generated with JS, | ||
// have the same display than the "local" ones. | ||
goto: file://|DOC_PATH|/implementors/trait.Whatever.html | ||
assert: "#implementors-list" | ||
// There are supposed to be two implementors listed. | ||
assert-count: ("#implementors-list > .impl", 2) | ||
// Now we check that both implementors have an anchor, an ID and a similar DOM. | ||
assert: ("#implementors-list > .impl:nth-child(1) > a.anchor") | ||
assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"}) | ||
assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"}) | ||
assert: "#implementors-list > .impl:nth-child(1) > code.in-band" | ||
|
||
assert: ("#implementors-list > .impl:nth-child(2) > a.anchor") | ||
assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"}) | ||
assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) | ||
assert: "#implementors-list > .impl:nth-child(2) > code.in-band" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This file is automatically @generated by Cargo. | ||
# It is not intended for manual editing. | ||
version = 3 | ||
|
||
[[package]] | ||
name = "implementors" | ||
version = "0.1.0" | ||
|
||
[[package]] | ||
name = "lib2" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"implementors", | ||
] | ||
|
||
[[package]] | ||
name = "test_docs" | ||
version = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"test_docs", | ||
"lib2", | ||
"implementors", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "implementors" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
path = "lib.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pub trait Whatever { | ||
fn method() {} | ||
} | ||
|
||
pub struct Struct; | ||
|
||
impl Whatever for Struct {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "lib2" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
path = "lib.rs" | ||
|
||
[dependencies] | ||
implementors = { path = "../implementors" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ impl Trait for Foo { | |
type X = u32; | ||
const Y: u32 = 0; | ||
} | ||
|
||
impl implementors::Whatever for Foo {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn it_works() { | ||
assert_eq!(2 + 2, 4); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "test_docs" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
path = "lib.rs" |
File renamed without changes.