Skip to content

Commit 41ac3f3

Browse files
Rollup merge of #87162 - GuillaumeGomez:type-decl-overflow, r=notriddle
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``
2 parents 8a8b285 + 25e7403 commit 41ac3f3

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/librustdoc/html/static/css/rustdoc.css

+3
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ code, pre, a.test-arrow {
247247
pre {
248248
padding: 14px;
249249
}
250+
.type-decl pre {
251+
overflow-x: auto;
252+
}
250253

251254
.source .content pre {
252255
padding: 20px;

src/test/rustdoc-gui/src/lib2/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,10 @@ pub mod sub_mod {
4747
/// ```
4848
pub struct Foo;
4949
}
50+
51+
pub mod long_trait {
52+
use std::ops::DerefMut;
53+
54+
pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: DerefMut<Target = u32>
55+
+ From<u128> + Send + Sync + AsRef<str> + 'static {}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
2+
goto: file://|DOC_PATH|/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html
3+
// We set a fixed size so there is no chance of "random" resize.
4+
size: (1100, 800)
5+
// Logically, the <body> scroll width should be the width of the window.
6+
assert-property: ("body", {"scrollWidth": "1100"})
7+
// However, since there is overflow in the type declaration, its scroll width is bigger.
8+
assert-property: (".type-decl pre", {"scrollWidth": "1324"})

0 commit comments

Comments
 (0)