Skip to content

Commit

Permalink
Rollup merge of #87162 - GuillaumeGomez:type-decl-overflow, r=notriddle
Browse files Browse the repository at this point in the history
Fix type decl layout "overflow"

Before:

![Screenshot from 2021-07-15 17-56-12](https://user-images.githubusercontent.com/3050060/125822644-c4595211-d75e-4dd7-ba44-183197ee836c.png)

After:

![Screenshot from 2021-07-15 17-56-17](https://user-images.githubusercontent.com/3050060/125822648-7b363847-e153-4ff3-9fba-59478e32eced.png)

cc ```@SergioBenitez```

r? ```@notriddle```
  • Loading branch information
GuillaumeGomez authored Jul 16, 2021
2 parents 4143379 + 25e7403 commit a547abe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ code, pre, a.test-arrow {
pre {
padding: 14px;
}
.type-decl pre {
overflow-x: auto;
}

.source .content pre {
padding: 20px;
Expand Down
7 changes: 7 additions & 0 deletions src/test/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ pub mod sub_mod {
/// ```
pub struct Foo;
}

pub mod long_trait {
use std::ops::DerefMut;

pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: DerefMut<Target = u32>
+ From<u128> + Send + Sync + AsRef<str> + 'static {}
}
8 changes: 8 additions & 0 deletions src/test/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
goto: file://|DOC_PATH|/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html
// We set a fixed size so there is no chance of "random" resize.
size: (1100, 800)
// Logically, the <body> scroll width should be the width of the window.
assert-property: ("body", {"scrollWidth": "1100"})
// However, since there is overflow in the type declaration, its scroll width is bigger.
assert-property: (".type-decl pre", {"scrollWidth": "1324"})

0 comments on commit a547abe

Please sign in to comment.