Rollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, r=GuillaumeGomez

Workaround blink/chromium grid layout limitation of 1000 rows

I made this in case we don't come up with a better solution in time.

See https://github.com/rust-lang/rust/issues/88545 for more details.

A rendered version of the standard library is hosted here:
https://data.estada.ch/rustdoc-nightly_497ee321af_2021-09-09/core/arch/arm/index.html

r? `@GuillaumeGomez` `@jsha`
This commit is contained in:
Manish Goregaokar 2021-09-10 08:23:25 -07:00 committed by GitHub
commit 3aaec559a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -256,6 +256,10 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
debug!("{:?}", indices); debug!("{:?}", indices);
let mut curty = None; let mut curty = None;
// See: https://github.com/rust-lang/rust/issues/88545
let item_table_block_size = 900usize;
let mut item_table_nth_element = 0usize;
for &idx in &indices { for &idx in &indices {
let myitem = &items[idx]; let myitem = &items[idx];
if myitem.is_stripped() { if myitem.is_stripped() {
@ -281,6 +285,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
id = cx.derive_id(short.to_owned()), id = cx.derive_id(short.to_owned()),
name = name name = name
); );
item_table_nth_element = 0;
} }
match *myitem.kind { match *myitem.kind {
@ -387,6 +392,13 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
); );
} }
} }
item_table_nth_element += 1;
if item_table_nth_element > item_table_block_size {
w.write_str(ITEM_TABLE_CLOSE);
w.write_str(ITEM_TABLE_OPEN);
item_table_nth_element = 0;
}
} }
if curty.is_some() { if curty.is_some() {