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 9 pull requests #88359

Closed
wants to merge 34 commits into from

Commits on Aug 17, 2021

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

Commits on Aug 21, 2021

  1. Configuration menu
    Copy the full SHA
    f1e8607 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d0b482a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0fa3b4f View commit details
    Browse the repository at this point in the history
  4. Use an exhaustive match in Node::ident() and add docs

    This should cause a compiler error in the future if more variants are
    added without `Node::ident()` being updated.
    camelid committed Aug 21, 2021
    Configuration menu
    Copy the full SHA
    02ed23c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    08ceac8 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2021

  1. Bless tests

    camelid committed Aug 22, 2021
    Configuration menu
    Copy the full SHA
    19f4510 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2021

  1. handle ascription type op in NLL HRTB diagnostics

    Refactors the `type_op_ascribe_user_type` query into a version which
    accepts a span, and uses it in the nicer NLL HRTB bound region errors.
    lqd committed Aug 23, 2021
    Configuration menu
    Copy the full SHA
    820e268 View commit details
    Browse the repository at this point in the history
  2. Update NLL HRTB type ascription blessed expectations

    Some of these tests have reached parity with the migrate-mode output.
    lqd committed Aug 23, 2021
    Configuration menu
    Copy the full SHA
    7b0e564 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2021

  1. Configuration menu
    Copy the full SHA
    a216d66 View commit details
    Browse the repository at this point in the history
  2. Add primitive documentation to libcore

    This works by doing two things:
    - Adding links that are specific to the crate. Since not all primitive
      items are defined in `core` (due to lang_items), these need to use
    relative links and not intra-doc links.
    - Duplicating `primitive_docs` in both core and std. This allows not needing CARGO_PKG_NAME to build the standard library. It also adds a tidy check to make sure they stay the same.
    jyn514 authored and GuillaumeGomez committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    6f5402e View commit details
    Browse the repository at this point in the history
  3. downgrade some logging

    jyn514 authored and GuillaumeGomez committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    b1de9bd View commit details
    Browse the repository at this point in the history
  4. Fix broken handling of primitive items

    - Fix broken handling of primitive associated items
    - Remove fragment hack
    
      Fixes 83083
    
    - more logging
    - Update CrateNum hacks
    
      The CrateNum has no relation to where in the dependency tree the crate
      is, only when it's loaded. Explicitly special-case core instead of
      assuming it will be the first DefId.
    
    - Update and add tests
    - Cache calculation of primitive locations
    
      This could possibly be avoided by passing a Cache into
      collect_intra_doc_links; but that's a much larger change, and doesn't
      seem valuable other than for this.
    jyn514 authored and GuillaumeGomez committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    64fe43c View commit details
    Browse the repository at this point in the history
  5. Fix linkcheck issues

    Most of these are because alloc uses `#[lang_item]` to define methods,
    but core documents primitives before those methods are available.
    
    - Fix run-make-fulldeps test
    
      I don't know why it assumed it could build core without cargo ...
    
    - Fix rustdoc-js-std test
    
      For some reason this change made CStr not show up in the results for
      `str,u8`. Since it still shows up for str, and since it wasn't a great
      match for that query anyway, I think this is ok to let slide.
    
    - Add test that all primitives can be linked to
    - Enable `doc(primitive)` in `core` as well
    jyn514 authored and GuillaumeGomez committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    dfedd33 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    41d815e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d7d122f View commit details
    Browse the repository at this point in the history
  8. trailing whitespace

    nikomatsakis authored Aug 25, 2021
    Configuration menu
    Copy the full SHA
    88bcd44 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    33c71ac View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    25406d5 View commit details
    Browse the repository at this point in the history
  11. Adjust spans

    * Highlight the whole pattern if it has no fields
    * Highlight the whole definition if it has no fields
    * Only highlight the pattern name if the pattern is multi-line
    * Determine whether a pattern is multi-line based on distance from name
      to last field, rather than first field
    camelid committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    8a6501d View commit details
    Browse the repository at this point in the history
  12. Reference tracking issue

    thomcc committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    5b25de5 View commit details
    Browse the repository at this point in the history
  13. Revert "Add type of a let tait test impl trait straight in let"

    This reverts commit dbadab5.
    This is not part of TAITs, so, if tested should probably be done
    elsewhere.
    spastorino committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    5df5659 View commit details
    Browse the repository at this point in the history
  14. Add field types tait tests

    spastorino committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    bb583f7 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    4fcae2c View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2021

  1. Configuration menu
    Copy the full SHA
    7e435ce View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#87073 - jyn514:primitive-docs, r=GuillaumeG…

    …omez
    
    Fix rustdoc handling of primitive items
    
    This is a complicated PR and does a lot of things. I'm willing to split it up a little more if it would help reviewing, but it would be tricky and I'd rather not unless it's necessary.
    
     ## What does this do?
    
    - Fixes rust-lang#73423.
    - Fixes rust-lang#79630. I'm not sure how to test this for the standard library explicitly, but you can see from some of the diffs from the `no_std` tests. I also tested it locally and it works correctly: ![image](https://user-images.githubusercontent.com/23638587/125214383-e1fdd000-e284-11eb-8048-76b5df958aad.png)
    - Fixes rust-lang#83083.
    
    ## Why are these changes interconnected?
    
    - Allowing anchors (rust-lang#83083) without fixing the online/offline problem (rust-lang#79630) will actually just silently discard the anchors, that's not a fix. The online/offline problem is directly related to the fragment hack; links need to go through `fn href()` to be fixed.
    - Technically I could fix the online/offline problem without removing the error on anchors; I am willing to separate that out if it would be helpful for reviewing. However I can't fix the anchor problem without adding docs to core, since rustdoc needs all those primitives to have docs to avoid a fallback, and currently `#![no_std]` crates don't have docs for primitives. I also can't fix the online/offline problem without removing the fragment hack, since otherwise diffs like this will be wrong for some primitives but not others:
    ```diff
    `@@` -385,7 +381,7 `@@` fn resolve_primitive_associated_item(
                             ty::AssocKind::Const => "associatedconstant",
                             ty::AssocKind::Type => "associatedtype",
                         };
    -                    let fragment = format!("{}#{}.{}", prim_ty.as_sym(), out, item_name);
    +                    let fragment = format!("{}.{}", out, item_name);
                         (Res::Primitive(prim_ty), fragment, Some((kind.as_def_kind(), item.def_id)))
                     })
             })
    ```
    - Adding primitive docs to core without making any other change will cause links to go to `core` instead of `std`, even for crates with `extern crate std`. See "Breaking changes to doc(primitive)" below for why this is the case. That said, I could add some special casing to rustdoc at the same time that would let me separate this change from the others (it would fix rust-lang#73423 but still special-case intra-doc links). I'm willing to separate that out if helpful for reviewing.
    
    ### Add primitive documentation to libcore
    
    This works by reusing the same `include!("primitive_docs.rs")` file in both core and std, and then special-casing links in core to use relative links instead of intra-doc links. This doesn't use purely intra-doc links because some of the primitive docs links to items only in std; this doesn't use purely relative links because that introduces new broken links when the docs are re-exported (e.g. String's `&str` deref impl, or Vec's slice deref impl).
    
    ### Fix inconsistent online/offline primitive docs
    
    This does four things:
    - Records modules with `doc(primitive)` in `cache.external_paths`. This is necessary for `href()` to find them later.
    - Makes `cache.primitive_locations` available to the intra-doc link pass, by refactoring out a `PrimitiveType::primitive_locations` function that only uses `TyCtxt`.
    - Special cases modules with `doc(primitive)` to be treated as always public for the purpose of links.
    - Removes the fragment hack. cc `@notriddle,` I know you added some comments about this in the code (thank you for that!)
    
    ### Breaking changes to `doc(primitive)`
    
    "Breaking" is a little misleading here - these are changes in behavior, none of them will cause code to fail to compile.
    
    Let me preface this by saying I think stabilizing `doc(primitive)` was a uniquely terrible idea. As far as I can tell, it was stabilized by oversight; it's been stable since 1.0. No one should have need to use it except the standard library, and a crater run shows that in fact no one is using it: rust-lang#87050 (comment). I hope to actually make `doc(primitive)` a no-op unless you opt-in with a nightly feature, which will keep crates compiling without forcing rustdoc into trying to keep somewhat arbitrary behavior guarantees; but for now, this just subtly changes some of the behavior if you use `doc(primitive)` in a dependency.
    
    That said, here are the changes:
    -  Refactoring out `primitive_locations()` is technically a change in behavior, since it no longer looks for primitives in crates that were passed through `--extern`, but not used by the crate; however, that seems like such an unlikely edge case it's not worth dealing with.
    - The precedence given to primitive locations is no longer just arbitrary, it can also be inconsistent from run to run. Let me explain that more: previously, primitive locations were sorted by the `CrateNum`; the comment on that sort said "Favor linking to as local extern as possible, so iterate all crates in reverse topological order." Unfortunately, that's not actually what CrateNum tracks: it measures the order crates are loaded, not the number of intermediate crates between that dependency and the root crate. It happened to work as intended before because the compiler injects `extern crate std;` at the top of every crate, which ensured it would have the first CrateNum other than the current, but every other CrateNum was completely arbitrary (for example, `core` often had a later CrateNum than `std`). This now removes the sort on CrateNum completely and special-cases core instead. In particular, if you depend on both `std` and a crate which defines a `doc(primitive)` module, it's arbitrary whether rustdoc will use the docs from std or the ones from the other crate. cc `@alexcrichton,` you wrote this originally.
    
    cc `@rust-lang/rustdoc`
    cc `@rust-lang/libs` for the addition to `core` (the commit you're interested in is rust-lang@36729b0)
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    e948f31 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#88123 - camelid:tup-pat-precise-spans, r=es…

    …tebank
    
    Make spans for tuple patterns in E0023 more precise
    
    As suggested in rust-lang#86307. Closes rust-lang#86307.
    
    r? ``@estebank``
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    b0d21ba View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#88216 - kornelski:from_layout_err, r=kennytm

    Don't stabilize creation of TryReserveError instances
    
    rust-lang#48043 + rust-lang#87993 (comment)
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    b937bd4 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#88270 - lqd:hrtb-type-ascription, r=nikomat…

    …sakis
    
    Handle type ascription type ops in NLL HRTB diagnostics
    
    Currently, there are still a few cases of the "higher-ranked subtype error" of yore, 4 of which are related to type ascription.
    
    This PR is a follow-up to rust-lang#86700, adding support for type ascription type ops, and makes 3 of these tests output the same diagnostics in NLL mode as the migrate mode (and 1 is now much closer, especially if you ignore that it already outputs an additional error in NLL mode -- which could be a duplicate caused by a lack of normalization like [these comments point out](https://github.com/rust-lang/rust/blob/9583fd1bdd0127328e25e5b8c24dff575ec2c86b/compiler/rustc_traits/src/type_op.rs#L122-L157), or an imprecision in some parts of normalization as [described here](rust-lang#86700 (comment))).
    
    Since we discussed these recently:
    - [here](rust-lang#86700 (comment)), cc ``@matthewjasper,``
    - and [here](rust-lang#57374 (comment)), cc ``@Aaron1011.``
    
    It should only leave [this TAIT test](https://github.com/rust-lang/rust/blob/9583fd1bdd0127328e25e5b8c24dff575ec2c86b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs) as still emitting [the terse error](https://github.com/rust-lang/rust/blob/9583fd1bdd0127328e25e5b8c24dff575ec2c86b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr).
    
    r? ``@estebank`` (so that they shake their fist at NLL's general direction less often) or ``@nikomatsakis`` or matthew or aaron, the more the merrier.
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    d3996cc View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#88320 - sexxi-goose:issue-88103, r=nikomats…

    …akis
    
    type_implements_trait consider obligation failure on overflow
    
    Fixes: rust-lang#88103
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    6fe3893 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#88340 - thomcc:c_size_t, r=joshtriplett

    Add `c_size_t` and `c_ssize_t` to `std::os::raw`.
    
    Apparently these aren't guaranteed to be the same, and are merely "always the same in practice" (see https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/.60usize.60.20vs.20.60size_t.60).
    
    This is a big footgun, but I suspect it can be alleviated if we expose this and start migrating people to it in advance of any platforms that ever have this as different.
    
    I'll file a tracking issue after this gets some traction.
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    6d18e94 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#88346 - spastorino:revert-type-of-a-let2, r…

    …=jackh726
    
    Revert "Add type of a let tait test impl trait straight in let"
    
    This reverts commit dbadab5.
    This is not part of TAITs, so, if tested should probably be done
    elsewhere.
    
    r? ``@oli-obk``
    
    This is similar to what I was commenting here rust-lang#88332 (comment)
    These is not part of TAITs so should not live in type-alias-impl-trait test directory.
    I'm going to avoid adding this kind of tests in `type-alias-impl-trait` test directory and avoid thinking about them in this pass.
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    ff7dda4 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#88348 - spastorino:field-types-tait-test, r…

    …=oli-obk
    
    Add field types tait tests
    
    r? ``@oli-obk``
    
    Related to rust-lang#86727
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    84e8622 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#88349 - spastorino:const-static-types-tait-…

    …test, r=oli-obk
    
    Add const and static TAIT tests
    
    r? ``@oli-obk``
    
    Related to rust-lang#86727
    GuillaumeGomez authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    e302595 View commit details
    Browse the repository at this point in the history