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 7 pull requests #116605

Merged
merged 22 commits into from
Oct 10, 2023
Merged

Rollup of 7 pull requests #116605

merged 22 commits into from
Oct 10, 2023

Commits on Sep 21, 2023

  1. Configuration menu
    Copy the full SHA
    9683f8a View commit details
    Browse the repository at this point in the history
  2. rustdoc-search: add impl disambiguator to duplicate assoc items

    Helps with rust-lang#90929
    
    This changes the search results, specifically, when there's more than
    one impl with an associated item with the same name. For example,
    the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>`
    don't link to the same function, but most of the functions have the
    same names.
    
    This change should probably be FCP-ed, especially since it adds a new
    anchor link format for `main.js` to handle, so that URLs like
    `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect
    to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there
    are a few reasons for it:
    
    * I'd like to avoid making the HTML bigger. Obviously, fixing this bug
      is going to add at least a little more data to the search index, but
      adding more HTML penalises viewers for the benefit of searchers.
    
    * Breaking `struct.Vec.html#method.len` would also be a disappointment.
    
    On the other hand:
    
    * The path-style anchors might be less prone to link rot than the numbered
      anchors. It's definitely less likely to have URLs that appear to "work",
      but silently point at the wrong thing.
    
    * This commit arranges the path-style anchor to redirect to the numbered
      anchor. Nothing stops rustdoc from doing the opposite, making path-style
      anchors the default and redirecting the "legacy" numbered ones.
    notriddle committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    3fbfe2b View commit details
    Browse the repository at this point in the history
  3. rustdoc: update test cases for changes to the printing style

    This whole thing changes it so that the JS and the UI both use
    rustc's own path printing to handle the impl IDs. This results in
    the format changing a little bit; full paths are used in spots
    where they aren't strictly necessary, and the path sometimes uses
    generics where the old system used the trait's own name, but it
    shouldn't matter since the orphan rules will prevent it anyway.
    notriddle committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    3583e86 View commit details
    Browse the repository at this point in the history
  4. rustdoc: wait for section to open before trying to highlight

    This fixes a problem where hash rewriting doesn't work with
    `:target` CSS rules.
    notriddle committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    20b93b9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2a4c9d0 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2023

  1. On type error of closure call argument, point at earlier calls that a…

    …ffected inference
    
    Mitigate part of  rust-lang#71209.
    
    ```
    error[E0308]: mismatched types
      --> $DIR/unboxed-closures-type-mismatch.rs:30:18
       |
    LL |         identity(1u16);
       |         -------- ^^^^ expected `u8`, found `u16`
       |         |
       |         arguments to this function are incorrect
       |
    note: expected because the closure was earlier called with an argument of type `u8`
      --> $DIR/unboxed-closures-type-mismatch.rs:29:18
       |
    LL |         identity(1u8);
       |         -------- ^^^ expected because this argument is of type `u8`
       |         |
       |         in this closure call
    note: closure parameter defined here
      --> $DIR/unboxed-closures-type-mismatch.rs:28:25
       |
    LL |         let identity = |x| x;
       |                         ^
    help: change the type of the numeric literal from `u16` to `u8`
       |
    LL |         identity(1u8);
       |                   ~~
       ```
    estebank committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    7bb594f View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2023

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

Commits on Oct 8, 2023

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

Commits on Oct 9, 2023

  1. Configuration menu
    Copy the full SHA
    bbc2304 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d60b43c View commit details
    Browse the repository at this point in the history
  3. defids are indexmapped

    ouz-a committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    0f27c1b View commit details
    Browse the repository at this point in the history
  4. alloc id is indexmapped

    ouz-a committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    5f079dd View commit details
    Browse the repository at this point in the history
  5. spans are now indexmapped

    ouz-a committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    77df2cd View commit details
    Browse the repository at this point in the history
  6. Update books

    rustbot committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    7962b96 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2023

  1. add new wrapper for FxIndexMap

    ouz-a committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    0bcb058 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#109422 - notriddle:notriddle/impl-disambigu…

    …ate-search, r=GuillaumeGomez
    
    rustdoc-search: add impl disambiguator to duplicate assoc items
    
    Preview (to see the difference, click the link and pay attention to the specific function that comes up):
    
    | Before | After |
    |--|--|
    | [`simd<i64>, simd<i64> -> simd<i64>`](https://doc.rust-lang.org/nightly/std/?search=simd%3Ci64%3E%2C%20simd%3Ci64%3E%20-%3E%20simd%3Ci64%3E) | [`simd<i64>, simd<i64> -> simd<i64>`](https://notriddle.com/rustdoc-demo-html-3/impl-disambiguate-search/std/index.html?search=simd%3Ci64%3E%2C%20simd%3Ci64%3E%20-%3E%20simd%3Ci64%3E) |
    | [`cow, vec -> bool`](https://doc.rust-lang.org/nightly/std/?search=cow%2C%20vec%20-%3E%20bool) | [`cow, vec -> bool`](https://notriddle.com/rustdoc-demo-html-3/impl-disambiguate-search/std/index.html?search=cow%2C%20vec%20-%3E%20bool)
    
    Helps with rust-lang#90929
    
    This changes the search results, specifically, when there's more than one impl with an associated item with the same name. For example, the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>` don't link to the same function, but most of the functions have the same names.
    
    This change should probably be FCP-ed, especially since it adds a new anchor link format for `main.js` to handle, so that URLs like `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there are a few reasons for it:
    
    * I'd like to avoid making the HTML bigger. Obviously, fixing this bug is going to add at least a little more data to the search index, but adding more HTML penalises viewers for the benefit of searchers.
    
    * Breaking `struct.Vec.html#method.len` would also be a disappointment.
    
    On the other hand:
    
    * The path-style anchors might be less prone to link rot than the numbered anchors. It's definitely less likely to have URLs that appear to "work", but silently point at the wrong thing.
    
    * This commit arranges the path-style anchor to redirect to the numbered anchor. Nothing stops rustdoc from doing the opposite, making path-style anchors the default and redirecting the "legacy" numbered ones.
    
    ### The bug
    
    On the "Before" links, this example search calls for `i64`:
    
    ![image](https://github.com/rust-lang/rust/assets/1593513/9431d89d-41dc-4f68-bbb1-3e2704a973d2)
    
    But if I click any of the results, I get `f64` instead.
    
    ![image](https://github.com/rust-lang/rust/assets/1593513/6d89c692-1847-421a-84d9-22e359d9cf82)
    
    The PR fixes this problem by adding enough information to the search result `href` to disambiguate methods with different types but the same name.
    
    More detailed description of the problem at:
    rust-lang#109422 (comment)
    
    > When a struct/enum/union has multiple impls with different type parameters, it can have multiple methods that have the same name, but which are on different impls. Besides Simd, [Any](https://doc.rust-lang.org/nightly/std/any/trait.Any.html?search=any%3A%3Adowncast) also demonstrates this pattern. It has three methods named `downcast`, on three different impls.
    >
    > When that happens, it presents a challenge in linking to the method. Normally we link like `#method.foo`. When there are multiple `foo`, we number them like `#method.foo`, `#method.foo-1`, `#method.foo-2`, etc.
    >
    > It also presents a challenge for our search code. Currently we store all the variants in the index, but don’t have any way to generate unambiguous URLs in the results page, or to distinguish them in the SERP.
    >
    > To fix this, we need three things:
    >
    > 1. A fragment format that fully specifies the impl type parameters when needed to disambiguate (`#impl-SimdOrd-for-Simd<i64,+LANES>/method.simd_max`)
    > 2. A search index that stores methods with enough information to disambiguate the impl they were on.
    > 3. A search results interface that can display multiple methods on the same type with the same name, when appropriate OR a disambiguation landing section on item pages?
    >
    > For reviewers: it can be hard to see the new fragment format in action since it immediately gets rewritten to the numbered form.
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    4be9cfa View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#116250 - estebank:closure-arg-inference-spa…

    …n, r=petrochenkov
    
    On type error of closure call argument, point at earlier calls that affected inference
    
    Mitigate part of  rust-lang#71209.
    
    When we encounter a type error on a specific argument of a closure call argument, where the closure's definition doesn't have a type specified, look for other calls of the closure to try and find the specific call that cased that argument to be inferred of the expected type.
    
    ```
    error[E0308]: mismatched types
      --> $DIR/unboxed-closures-type-mismatch.rs:30:18
       |
    LL |         identity(1u16);
       |         -------- ^^^^ expected `u8`, found `u16`
       |         |
       |         arguments to this function are incorrect
       |
    note: expected because the closure was earlier called with an argument of type `u8`
      --> $DIR/unboxed-closures-type-mismatch.rs:29:18
       |
    LL |         identity(1u8);
       |         -------- ^^^ expected because this argument is of type `u8`
       |         |
       |         in this closure call
    note: closure parameter defined here
      --> $DIR/unboxed-closures-type-mismatch.rs:28:25
       |
    LL |         let identity = |x| x;
       |                         ^
    help: change the type of the numeric literal from `u16` to `u8`
       |
    LL |         identity(1u8);
       |                   ~~
    ```
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    0e5e04b View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#116444 - RalfJung:broken-unused-const, r=ol…

    …i-obk
    
    add test for const-eval error in dead code during monomorphization
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    bbaf6bd View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#116503 - ehuss:fix-mips-tier, r=Amanieu

    Update docs for mips target tier demotion.
    
    These mips targets were demoted in rust-lang#113274, but the documentation was not updated. I have also elected to document this in the release notes for 1.72 because I think that should have been included.
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    fccf9ec View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#116559 - Kritzefitz:btree-new-in-const, r=A…

    …manieu
    
    Mark `new_in` as `const` for BTree collections
    
    Discussed in and closes rust-lang/wg-allocators#118
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    b72db84 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#116560 - ouz-a:efficient_ids, r=oli-obk

    In smir use `FxIndexMap` to store indexed ids
    
    Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.
    
    Addresses rust-lang/project-stable-mir#35
    
    r? ``@oli-obk``
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    100713e View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#116574 - rustbot:docs-update, r=ehuss

    Update books
    
    ## rust-lang/reference
    
    2 commits in 5262e1c3b43a2c489df8f6717683a44c7a2260fd..142b2ed77d33f37a9973772bd95e6144ed9dce43
    2023-10-07 19:41:21 UTC to 2023-09-26 12:26:35 UTC
    
    - replace 'UB on raw ptr deref' with UB on place projection/access (rust-lang/reference#1387)
    - docs: Fix links to ECMA standards in `attributes.md` (rust-lang/reference#1408)
    
    ## rust-lang/rust-by-example
    
    11 commits in c954202c1e1720cba5628f99543cc01188c7d6fc..8eb3a01ab74c567b7174784892fb807f2c632d6b
    2023-09-26 12:38:17 UTC to 2023-09-26 12:29:10 UTC
    
    - fixed a typo in the lifetime.md (rust-lang/rust-by-example#1737)
    - Misleading textual statement in HOF (rust-lang/rust-by-example#1731)
    - Equalize title from respective file with title in SUMMARY.md (rust-lang/rust-by-example#1738)
    - Added explanation for compiling and executing match_args.rs. (rust-lang/rust-by-example#1739)
    - Wrapped long lines and put #[doc] in backquotes. (rust-lang/rust-by-example#1740)
    - Update read_lines example to flatten iterator (rust-lang/rust-by-example#1742)
    - Update while_let.md: address inconsistent use of fn main between 2 co… (rust-lang/rust-by-example#1744)
    - [TRIVIAL] Remove confusing `also` (rust-lang/rust-by-example#1746)
    - Fix and extend the explanation of outer vs inner attributes. (rust-lang/rust-by-example#1748)
    - Fix uncorresponded back quote (rust-lang/rust-by-example#1749)
    - Fix format in constants.md (rust-lang/rust-by-example#1741)
    
    ## rust-lang/rustc-dev-guide
    
    3 commits in a13b7c28ed705891c681ce5417b3d1cdb12cecd1..b98af7d661e4744baab81fb8dc7a049e44a4a998
    2023-10-05 19:48:35 UTC to 2023-09-27 22:57:27 UTC
    
    - update new trait solver docs (rust-lang/rustc-dev-guide#1802)
    - update rustc_driver examples (rust-lang/rustc-dev-guide#1803)
    - test headers: fix `compile-flags` example (rust-lang/rustc-dev-guide#1800)
    GuillaumeGomez committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    49dd50b View commit details
    Browse the repository at this point in the history