diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-21 22:03:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-21 22:03:20 +0100 |
| commit | 26e9357faed8bf79d9881bafd49c984107485ede (patch) | |
| tree | ca06814247b7a193b13d3b8136800f17d58541f0 /src/test/rustdoc-gui | |
| parent | 081d65fa4a9fdf6703e93511632582b9fad383ee (diff) | |
| parent | 9d178e5e8d7943da8f1b4b645911f300178f5070 (diff) | |
| download | rust-26e9357faed8bf79d9881bafd49c984107485ede.tar.gz rust-26e9357faed8bf79d9881bafd49c984107485ede.zip | |
Rollup merge of #93139 - jsha:fix-wrapped-names, r=Nemo157
rustdoc: fix overflow-wrap for table layouts For all table layouts, set overflow-wrap: break-word. Fixes #93135 Demo: https://rustdoc.crud.net/jsha/fix-wrapped-names/std/intrinsics/index.html#functions (Compare vs https://doc.rust-lang.org/nightly/std/intrinsics/index.html - you may have to make your browser narrower to see the effect) r? `@Nemo157`
Diffstat (limited to 'src/test/rustdoc-gui')
| -rw-r--r-- | src/test/rustdoc-gui/src/lib2/lib.rs | 39 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/type-declation-overflow.goml | 4 |
2 files changed, 29 insertions, 14 deletions
diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 79354ec8745..73013c9778f 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -39,7 +39,6 @@ impl Trait for Foo { const Y: u32 = 0; } - impl implementors::Whatever for Foo { type Foo = u32; } @@ -58,8 +57,10 @@ pub mod sub_mod { pub mod long_trait { use std::ops::DerefMut; - pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: DerefMut<Target = u32> - + From<u128> + Send + Sync + AsRef<str> + 'static {} + pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: + DerefMut<Target = u32> + From<u128> + Send + Sync + AsRef<str> + 'static + { + } } pub mod long_table { @@ -88,18 +89,28 @@ pub mod summary_table { } pub mod too_long { -pub type ReallyLongTypeNameLongLongLong = Option<unsafe extern "C" fn(a: *const u8, b: *const u8) -> *const u8>; - -pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0; - -pub struct SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { - pub a: u32, -} + pub type ReallyLongTypeNameLongLongLong = + Option<unsafe extern "C" fn(a: *const u8, b: *const u8) -> *const u8>; + + pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0; + + /// This also has a really long doccomment. Lorem ipsum dolor sit amet, + /// consectetur adipiscing elit. Suspendisse id nibh malesuada, hendrerit + /// massa vel, tincidunt est. Nulla interdum, sem ac efficitur ornare, arcu + /// nunc dignissim nibh, at rutrum diam augue ac mauris. Fusce tincidunt et + /// ligula sed viverra. Aenean sed facilisis dui, non volutpat felis. In + /// vitae est dui. Donec felis nibh, blandit at nibh eu, tempor suscipit + /// nisl. Vestibulum ornare porta libero, eu faucibus purus iaculis ut. Ut + /// quis tincidunt nunc, in mollis purus. Nulla sed interdum quam. Nunc + /// vitae cursus ex. + pub struct SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { + pub a: u32, + } -impl SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { - /// ``` - /// let x = SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { a: 0 }; - /// ``` + impl SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { + /// ``` + /// let x = SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { a: 0 }; + /// ``` pub fn foo(&self) {} } } diff --git a/src/test/rustdoc-gui/type-declation-overflow.goml b/src/test/rustdoc-gui/type-declation-overflow.goml index 21874f786f1..c35b38747df 100644 --- a/src/test/rustdoc-gui/type-declation-overflow.goml +++ b/src/test/rustdoc-gui/type-declation-overflow.goml @@ -7,6 +7,10 @@ assert-property: ("body", {"scrollWidth": "1100"}) // However, since there is overflow in the type declaration, its scroll width is bigger. assert-property: (".item-decl pre", {"scrollWidth": "1324"}) +// In the table-ish view on the module index, the name should not be wrapped more than necessary. +goto: file://|DOC_PATH|/lib2/too_long/index.html +assert-property: (".item-table .struct", {"offsetWidth": "684"}) + // We now make the same check on type declaration... goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html assert-property: ("body", {"scrollWidth": "1100"}) |
