Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #82756

Merged
merged 27 commits into from
Mar 4, 2021
Merged

Rollup of 8 pull requests #82756

merged 27 commits into from
Mar 4, 2021

Commits on Feb 26, 2021

  1. Configuration menu
    Copy the full SHA
    2f04a79 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2021

  1. Rename rustdoc lints to be a tool lint instead of built-in.

    - Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
    - Ensure that the old lint names still work and give deprecation errors
    - Register lints even when running doctests
    
      Otherwise, all `rustdoc::` lints would be ignored.
    
    - Register all existing lints as removed
    
      This unfortunately doesn't work with `register_renamed` because tool
      lints have not yet been registered when rustc is running. For similar
      reasons, `check_backwards_compat` doesn't work either. Call
      `register_removed` directly instead.
    
    - Fix fallout
    
      + Rustdoc lints for compiler/
      + Rustdoc lints for library/
    
    Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
    `rustdoc::intra_doc_link_resolution_failure`, since there was no time
    when the latter was valid.
    jyn514 committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    cc62018 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    37e4cfe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7195355 View commit details
    Browse the repository at this point in the history
  4. Improve error messages

    - Use `register_renamed` when rustdoc is running so the lint will still
      be active and use a structured suggestion
    - Test the behavior for rustc, not just for rustdoc (because it differs)
    jyn514 committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    e8ddfda View commit details
    Browse the repository at this point in the history
  5. Address review comments

    - Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly
    - Update documentation
    
    This also takes the opportunity to make the `no-crate-level-doc-lint`
    test more specific.
    jyn514 committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    0517ea7 View commit details
    Browse the repository at this point in the history
  6. Update comments

    Note that the FIXME was removed because this can't be fixed,
    `register_renamed` calls LintId::of and there's no LintId for rustdoc
    lints when rustc is running.
    jyn514 committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    c7535d1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    75efb6e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c194849 View commit details
    Browse the repository at this point in the history
  9. Load rustdoc's JS search index on-demand.

    Instead of being loaded on every page, the JS search index is now
    loaded when either (a) there is a `?search=` param, or (b) the search
    input is focused.
    
    This saves both CPU and bandwidth. As of Feb 2021,
    https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes
    gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms
    of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100
    ms page reload).
    
    Generate separate JS file with crate names.
    
    This is much smaller than the full search index, and is used in the "hot
    path" to draw the page. In particular it's used to crate the dropdown
    for the search bar, and to append a list of crates to the sidebar (on
    some pages).
    
    Skip early search that can bypass 500ms timeout.
    
    This was occurring when someone had typed some text during the load of
    search-index.js. Their query was usually not ready to execute, and the
    search itself is fairly expensive, delaying the overall load, which
    delayed the input / keyup events, which delayed eventually executing the
    query.
    jsha committed Mar 2, 2021
    Configuration menu
    Copy the full SHA
    768d5e9 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9c4e3af View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a1835bc View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2021

  1. Improve page load performance in rustdoc.

    Add font-display: swap. Per https://web.dev/font-display/, this prevents
    "flash of invisible text" during load by using a system font until the
    custom font is available. I've noticed this flash of invisible text
    occasionally when reading Rust docs.
    
    Add an explicit height to icons (which already had an explicit width)
    to allow browsers to lay out the page more accurately before the icons
    have been loaded. https://web.dev/optimize-cls/.
    
    Add min-width: 115px to the crate search dropdown. When the HTML first
    loads, this dropdown includes only the text "All crates." Later, JS
    loads the items underneath it, some of which are wider. That causes
    the dropdown to get wider, causing a distracting reflow. This sets a
    min-width based on the size that the dropdown eventually becomes based
    on the crates on doc.rust-lang.org, reducing page movement during load.
    jsha committed Mar 3, 2021
    Configuration menu
    Copy the full SHA
    d3e7ffa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5824917 View commit details
    Browse the repository at this point in the history
  3. Use Arial as fallback font instead of sans-serif.

    On most platforms and browsers, `sans-serif` is equivalent to Arial.
    However, on Firefox on Ubuntu (and possibly other Linuxes), `sans-serif`
    is DejaVu Sans, a much wider font. This creates a larger shift in text
    when the custom fonts finally load. Arial is a web-safe font, and
    specifying it explicitly gives us more cross-platform consistency, as
    well as reducing the layout shift that happens when fonts load.
    jsha committed Mar 3, 2021
    Configuration menu
    Copy the full SHA
    f9cfe15 View commit details
    Browse the repository at this point in the history
  4. Update library/alloc/src/vec/mod.rs

    Co-authored-by: Ralf Jung <[email protected]>
    WaffleLapkin and RalfJung authored Mar 3, 2021
    Configuration menu
    Copy the full SHA
    950f121 View commit details
    Browse the repository at this point in the history
  5. reworded message

    estebank committed Mar 3, 2021
    Configuration menu
    Copy the full SHA
    5d0697b View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2021

  1. Fix commit detected when using download-rustc

    On reflection on the issue in rust-lang#79540 (comment),  I think the bug was actually using the `compiler/` filter, not using `--author=bors`. rust-lang@9a1d617 has no CI artifacts because it was merged as part of a rollup:
    ```
    $ curl -I https://ci-artifacts.rust-lang.org/rustc-builds/96e843ce6ae42e0aa519ba45e148269de347fd84/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
    HTTP/2 404
    ```
    So 9a1d617 is the correct commit to download, and that's what `--author=bors` does:
    
    $ git log --author=bors 4aec8a5
    commit 9a1d617
    
    Ideally it would look for "the most recent bors commit not followed by a change to `compiler/`", which would exclude things like documentation changes and avoid redownloading more than necessary, but
    - Redownloading isn't the end of the world,
    - That metric is hard to implement, and
    - Documentation-only or library-only changes are very rare anyway since they're usually rolled up with changes to the compiler.
    jyn514 committed Mar 4, 2021
    Configuration menu
    Copy the full SHA
    a705a58 View commit details
    Browse the repository at this point in the history
  2. Pass CrateNum by value instead of by reference

    It's more idiomatic to pass a small Copy type by value and `CrateNum` is
    half the size of `&CrateNum` on 64-bit systems. The memory use change is
    almost certainly insignificant, but why not!
    camelid committed Mar 4, 2021
    Configuration menu
    Copy the full SHA
    c79af86 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#80527 - jyn514:rustdoc-lints, r=GuillaumeGomez

    Make rustdoc lints a tool lint instead of built-in
    
    - Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though).
    - Ensure that the old lint names still work and give deprecation errors
    - Register lints even when running doctests
    - Move lint machinery into a separate file
    - Add `declare_rustdoc_lint!` macro
    
    Unblocks rust-lang#80300, rust-lang#79816, rust-lang#80965. Makes the strangeness in rust-lang#77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes rust-lang#78786.
    
    ## Current status
    
    This is blocked on rust-lang#82620 (see rust-lang#80527 (comment))
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    f898aa3 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#82310 - jsha:rustdoc-search-onfocus, r=Guil…

    …laumeGomez
    
    Load rustdoc's JS search index on-demand.
    
    Instead of being loaded on every page, the JS search index is now loaded when either (a) there is a `?search=` param, or (b) the search input is focused.
    
    This saves both CPU and bandwidth. As of Feb 2021, https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100 ms page reload).
    
    Tested on Firefox and Chrome.
    
    New:
    https://jacob.hoffman-andrews.com/rust/search-on-demand/std/primitive.slice.html
    https://jacob.hoffman-andrews.com/rust/search-on-demand/std/primitive.slice.html?search=fn
    
    Old:
    https://jacob.hoffman-andrews.com/rust/search-on-load/std/primitive.slice.html
    https://jacob.hoffman-andrews.com/rust/search-on-load/std/primitive.slice.html?search=fn
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    36b7bef View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#82315 - jsha:font-display-swap, r=Guillaume…

    …Gomez
    
    Improve page load performance in rustdoc
    
    Add an explicit height to icons (which already had an explicit width) to allow browsers to lay out the page more accurately before the icons have been loaded. https://web.dev/optimize-cls/.
    
    Add min-width: 115px to the crate search dropdown. When the HTML first loads, this dropdown includes only the text "All crates." Later, JS loads the items underneath it, some of which are wider. That causes the dropdown to get wider, causing a distracting reflow. This sets a min-width based on the size that the dropdown eventually becomes based on the crates on doc.rust-lang.org, reducing page movement during load.
    
    Add font-display: swap. Per https://web.dev/font-display/, this prevents "flash of invisible text" during load by using a system font until the custom font is available. I've noticed this flash of invisible text occasionally when reading Rust docs. Note that users without cached fonts will see text, and then see it reflow. For `docs.rust-lang.org`, [setting caching headers will help a lot](rust-lang/simpleinfra#62).
    
    Generated output at https://jacob.hoffman-andrews.com/rust/flow-improvements/std/string/struct.String.html.
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    569f033 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#82564 - WaffleLapkin:revert_spare_mut, r=Ra…

    …lfJung
    
    Revert `Vec::spare_capacity_mut` impl to prevent pointers invalidation
    
    The implementation was changed in rust-lang#79015.
    
    Later it was [pointed out](rust-lang#81944 (comment)) that the implementation invalidates pointers to the buffer (initialized elements) by creating a unique reference to the buffer. This PR reverts the implementation.
    
    r? ```@RalfJung```
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    290117f View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#82697 - jplatte:patch-1, r=davidtwco

    Fix stabilization version of move_ref_pattern
    
    Both the [changelog](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1490-2020-12-31) and the milestone of the [stabilization PR](rust-lang#76119) say 1.49.0, but the source says 1.48.0. I think the former is correct.
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    761ceab View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#82717 - estebank:issue-70152, r=lcnr

    Account for macros when suggesting adding lifetime
    
    Fix rust-lang#70152.
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    c398871 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#82740 - jyn514:proper-history, r=Mark-Simul…

    …acrum
    
    Fix commit detected when using `download-rustc`
    
    On reflection on the issue in rust-lang#79540 (comment), I think the bug was actually using the `compiler/` filter, not using `--author=bors`. rust-lang@9a1d617 has no CI artifacts because it was merged as part of a rollup:
    ```
    $ curl -I https://ci-artifacts.rust-lang.org/rustc-builds/96e843ce6ae42e0aa519ba45e148269de347fd84/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
    HTTP/2 404
    ```
    So 9a1d617 is the correct commit to download, and that's what `--author=bors` does:
    
    $ git log --author=bors 4aec8a5
    commit 9a1d617
    
    Ideally it would look for "the most recent bors commit not followed by a change to `compiler/`", which would exclude things like documentation changes and avoid redownloading more than necessary, but
    - Redownloading isn't the end of the world,
    - That metric is hard to implement, and
    - Documentation-only or library-only changes are very rare anyway since they're usually rolled up with changes to the compiler.
    
    Helps with rust-lang#81930.
    
    r? `@Mark-Simulacrum`
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    17121f2 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#82744 - camelid:cratenum-byval, r=Guillaume…

    …Gomez
    
    Pass `CrateNum` by value instead of by reference
    
    It's more idiomatic to pass a small Copy type by value and `CrateNum` is
    half the size of `&CrateNum` on 64-bit systems. The memory use change is
    almost certainly insignificant, but why not!
    JohnTitor authored Mar 4, 2021
    Configuration menu
    Copy the full SHA
    06630f7 View commit details
    Browse the repository at this point in the history