1. 10 5月, 2021 12 次提交
    • D
      Rollup merge of #85050 - FabianWolff:issue-84592, r=jackh726 · 0740015d
      Dylan DPC 提交于
      Fix suggestions for missing return type lifetime specifiers
      
      This pull request aims to fix #84592. The issue is that the current code seems to assume that there is only a single relevant span pointing to the missing lifetime, and only looks at the first one:
      https://github.com/rust-lang/rust/blob/e5f83d24aee866a14753a7cedbb4e301dfe5bef5/compiler/rustc_resolve/src/late/lifetimes.rs#L2959
      
      This is incorrect, though, and leads to incorrect error messages and invalid suggestions. For instance, the example from #84592:
      ```rust
      struct TwoLifetimes<'x, 'y> {
          x: &'x (),
          y: &'y (),
      }
      
      fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
          TwoLifetimes { x: &(), y: &() }
      }
      ```
      currently leads to:
      ```
      error[E0106]: missing lifetime specifiers
       --> src/main.rs:6:57
        |
      6 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
        |                            ---     ---                  ^^ expected 2 lifetime parameters
        |
        = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
      help: consider introducing a named lifetime parameter
        |
      6 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'_<'a, 'a>, '_> {
        |                        ^^^^    ^^^^^^     ^^^^^^                  ^^^^^^^^^^
      ```
      There are two problems:
      - The error message is wrong. There is only _one_ lifetime parameter expected at the location pointed to by the error message (and another one at a separate location).
      - The suggestion is incorrect and will not lead to correct code.
      
      With the changes in this PR, I get the following output:
      ```
      error[E0106]: missing lifetime specifiers
       --> p.rs:6:57
        |
      6 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
        |                            ---     ---                  ^^  ^^ expected named lifetime parameter
        |                                                         |
        |                                                         expected named lifetime parameter
        |
        = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
      help: consider introducing a named lifetime parameter
        |
      6 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> {
        |                        ^^^^    ^^^^^^     ^^^^^^                  ^^  ^^
      
      error: aborting due to previous error
      
      For more information about this error, try `rustc --explain E0106`.
      ```
      Mainly, I changed `add_missing_lifetime_specifiers_label()` to receive a _vector_ of spans (and counts) instead of just one, and adjusted its body accordingly.
      0740015d
    • F
      More minor fixes suggested by @jackh726 · 2448c769
      Fabian Wolff 提交于
      2448c769
    • B
      Auto merge of #85053 - camsteffen:duplicate-lint, r=davidtwco · 1b30245e
      bors 提交于
      Fix duplicate unknown lint errors
      
      Fixes rust-lang/rust-clippy#6602
      1b30245e
    • B
      Auto merge of #85104 - hi-rustin:rustin-patch-typo, r=jonas-schievink · 2fb1dee1
      bors 提交于
      Fix typo
      2fb1dee1
    • B
      Auto merge of #85074 - GuillaumeGomez:end-toggle-migration, r=jsha · 00f2bf40
      bors 提交于
      Migrate top doc and non-exhaustive toggles to details tag
      
      Fixes #83332.
      
      r? `@jsha`
      00f2bf40
    • B
      Auto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisa · d29289c5
      bors 提交于
      Add primary marker on codegen unit and generate main wrapper on primary codegen.
      
      This is the codegen part of changes extracted from #84062.
      
      This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.
      
      cc #28937
      
      I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
      r? `@nagisa`
      d29289c5
    • G
      Update rustdoc test · 3837c1ce
      Guillaume Gomez 提交于
      3837c1ce
    • G
      End toggle migration · 4edcf614
      Guillaume Gomez 提交于
      4edcf614
    • B
      Auto merge of #83800 - xobs:impl-16351-nightly, r=nagisa · c55c26cb
      bors 提交于
      Add default search path to `Target::search()`
      
      The function `Target::search()` accepts a target triple and returns a `Target` struct defining the requested target.
      
      There is a `// FIXME 16351: add a sane default search path?` comment that indicates it is desirable to include some sort of default. This was raised in https://github.com/rust-lang/rust/issues/16351 which was closed without any resolution.
      
      https://github.com/rust-lang/rust/pull/31117 was proposed, however that has platform-specific logic that is unsuitable for systems without `/etc/`.
      
      This patch implements the suggestion raised in https://github.com/rust-lang/rust/issues/16351#issuecomment-180878193 where a `target.json` file may be placed in `$(rustc --print sysroot)/lib/rustlib/<target-triple>/target.json`. This allows shipping a toolchain distribution as a single file that gets extracted to the sysroot.
      c55c26cb
    • F
      Implement @jackh726's suggestions · 3c0c3874
      Fabian Wolff 提交于
      3c0c3874
    • B
      Auto merge of #85065 - Mark-Simulacrum:preds-no-alloc, r=jackh726 · ca82264e
      bors 提交于
      Avoid predecessors having Drop impls
      
      Should be a simple win - but let's make sure with perf.
      ca82264e
    • B
      Auto merge of #83894 - nikic:newpm, r=nagisa · 7a2f4468
      bors 提交于
      Improve support for NewPM
      
      This adds various missing bits of support for NewPM and allows us to successfully run stage 2 tests with NewPM enabled.
      
      This does not yet enable NewPM by default, as there are still known issue on LLVM 12 (such as a weak fat LTO pipeline). The plan is to make the switch after we update to LLVM 13.
      7a2f4468
  2. 09 5月, 2021 15 次提交
  3. 08 5月, 2021 13 次提交