1. 25 6月, 2022 1 次提交
  2. 24 6月, 2022 39 次提交
    • B
      Auto merge of #98397 - RalfJung:miri, r=RalfJung · fdca237d
      bors 提交于
      update Miri
      
      Fixes https://github.com/rust-lang/rust/issues/98366
      r? `@ghost` Cc `@rust-lang/miri`
      fdca237d
    • B
      Auto merge of #98447 - JohnTitor:rollup-pponoo3, r=JohnTitor · 7036449c
      bors 提交于
      Rollup of 9 pull requests
      
      Successful merges:
      
       - #91264 (Add macro support in jump to definition feature)
       - #96955 (Remove (transitive) reliance on sorting by DefId in pretty-printer)
       - #97633 (Session object: Set OS/ABI)
       - #98039 (Fix `panic` message for `BTreeSet`'s `range` API and document `panic` cases)
       - #98214 (rustc_target: Remove some redundant target properties)
       - #98280 (Improve suggestion for calling fn-like expr on type mismatch)
       - #98394 (Fixup missing renames from `#[main]` to `#[rustc_main]`)
       - #98411 (Update tendril)
       - #98419 (Remove excess rib while resolving closures)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      7036449c
    • Y
      Rollup merge of #98419 - WaffleLapkin:remove_excess_rib, r=compiler-errors · 5e98e556
      Yuki Okushi 提交于
      Remove excess rib while resolving closures
      
      I've mentioned this on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ClosureOrAsyncRibKind.60.20weirdness/near/286982959), in `rustc_resolve`, while resolving closures we add an excess `ClosureOrAsyncRibKind`. It's excess because we later add another one in `visit_fn`.
      
      I couldn't find a way in which removing this will break anything, all test seem to pass, etc.
      
      r? ``@compiler-errors``
      cc ``@davidtwco``
      5e98e556
    • Y
      Rollup merge of #98411 - ehuss:update-tendril, r=Mark-Simulacrum · d26b03c4
      Yuki Okushi 提交于
      Update tendril
      
      The 0.4.1 version of `tendril` (used by mdbook) triggers the `unaligned_references` lint which is now reported as a future-compatibility warning as of #95372. This updates it to 0.4.3 which does not trigger the warning. This update also triggered the update of `futf` from 0.1.4 to 0.1.5.
      
      tendril changes: https://github.com/servo/tendril/compare/v0.4.1...v0.4.3
      futf changes: https://github.com/servo/futf/compare/v0.1.4...v0.1.5
      d26b03c4
    • Y
      Rollup merge of #98394 - Enselic:fixup-rustc_main-renames, r=petrochenkov · f3078d0f
      Yuki Okushi 提交于
      Fixup missing renames from `#[main]` to `#[rustc_main]`
      
      In #84217 `#[main]` was removed and replaced with `#[rustc_main]`. In some places the rename was forgotten, which makes the current code confusing, because at first glance it seems that `#[main]` is still around. Perform the renames also in these places.
      
      I noticed this (after first being confused by it) when working on #97802.
      
      r? `@petrochenkov`
      
      (since you reviewed the other PR)
      f3078d0f
    • Y
      Rollup merge of #98280 - compiler-errors:better-call-closure-on-type-err, r=estebank · 964fc41b
      Yuki Okushi 提交于
      Improve suggestion for calling fn-like expr on type mismatch
      
      1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty`
      2.) Suggest calling closures even when they're not assigned to a local variable first
      3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`)
      
      r? ```@estebank```
      964fc41b
    • Y
      Rollup merge of #98214 - petrochenkov:islike, r=compiler-errors · 33eb3c05
      Yuki Okushi 提交于
      rustc_target: Remove some redundant target properties
      
      `is_like_emscripten` is equivalent to `os == "emscripten"`, so it's removed.
      `is_like_fuchsia` is equivalent to `os == "fuchsia"`, so it's removed.
      `is_like_osx` also falls into the same category and is equivalent to `vendor == "apple"`, but it's commonly used so I kept it as is for now.
      
      `is_like_(solaris,windows,wasm)` are combinations of different operating systems or architectures (see compiler/rustc_target/src/spec/tests/tests_impl.rs) so they are also kept as is.
      
      I think `is_like_wasm` (and maybe `is_like_osx`) are sufficiently closed sets, so we can remove these fields as well and replace them with methods like `fn is_like_wasm() { arch == "wasm32" || arch == "wasm64" }`.
      On other hand, `is_like_solaris` and `is_like_windows` are sufficiently open and I can imagine custom targets introducing other values for `os`.
      This is kind of a gray area.
      33eb3c05
    • Y
      Rollup merge of #98039 - tnballo:master, r=thomcc · 6580d7e7
      Yuki Okushi 提交于
      Fix `panic` message for `BTreeSet`'s `range` API and document `panic` cases
      
      Currently, the `panic` cases for [`BTreeSet`'s `range` API](https://doc.rust-lang.org/std/collections/struct.BTreeSet.html#method.range) are undocumented and produce a slightly wrong `panic` message (says `BTreeMap` instead of `BTreeSet`).
      
      Panic case 1 code:
      
      ```rust
      use std::collections::BTreeSet;
      use std::ops::Bound::Excluded;
      
      fn main() {
          let mut set = BTreeSet::new();
          set.insert(3);
          set.insert(5);
          set.insert(8);
      
          for &elem in set.range((Excluded(&3), Excluded(&3))) {
              println!("{elem}");
          }
      }
      ```
      
      Panic case 1 message:
      
      ```
      thread 'main' panicked at 'range start and end are equal and excluded in BTreeMap', /rustc/fe5b13d6/library/alloc/src/collections/btree/search.rs:105:17
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      ```
      
      Panic case 2 code:
      
      ```rust
      use std::collections::BTreeSet;
      use std::ops::Bound::Included;
      
      fn main() {
          let mut set = BTreeSet::new();
          set.insert(3);
          set.insert(5);
          set.insert(8);
      
          for &elem in set.range((Included(&8), Included(&3))) {
              println!("{elem}");
          }
      }
      ```
      
      Panic case 2:
      
      ```
      thread 'main' panicked at 'range start is greater than range end in BTreeMap', /rustc/fe5b13d6/library/alloc/src/collections/btree/search.rs:110:17
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      ```
      
      This PR fixes the output messages to say `BTreeSet`, adds the relevant unit tests, and updates the documentation for the API.
      6580d7e7
    • Y
    • Y
      Rollup merge of #96955 - Aaron1011:pretty-print-sort, r=petrochenkov · 2c6feb51
      Yuki Okushi 提交于
      Remove (transitive) reliance on sorting by DefId in pretty-printer
      
      This moves us a step closer to removing the `PartialOrd/`Ord` impls
      for `DefId`. See #90317
      2c6feb51
    • Y
      Rollup merge of #91264 - GuillaumeGomez:macro-jump-to-def, r=jsha · 97f4d7bd
      Yuki Okushi 提交于
      Add macro support in jump to definition feature
      
      Fixes #91174.
      
      To do so, I check if the span comes from an expansion, and if so, I infer the original macro `DefId` or `Span` depending if it's a defined in the current crate or not.
      
      There is one limitation due to macro expansion though:
      
      ```rust
      macro_rules! yolo { () => {}}
      
      fn foo() {
          yolo!();
      }
      ```
      
      In `foo`, `yolo!` won't be linked because after expansion, it is replaced by nothing (which seems logical). So I can't get an item from the `Visitor` from which I could tell if its `Span` comes from an expansion.
      
      I added a test for this specific limitation alongside others.
      
      Demo: https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html
      
      As for the empty macro issue that cannot create a jump to definition, you can see it [here](https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html#35).
      
      r? ```@jyn514```
      97f4d7bd
    • B
      Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726 · d017d59e
      bors 提交于
      fix universes in the NLL type tests
      
      In the NLL code, we were not accommodating universes in the
      `type_test` logic.
      
      Fixes #98095.
      
      r? `@compiler-errors`
      
      This breaks some tests, however, so the purpose of this branch is more explanatory and perhaps to do a crater run.
      d017d59e
    • B
      Auto merge of #98395 - arlosi:update-cargo, r=ehuss · fc96600b
      bors 提交于
      Update cargo
      
      8 commits in 03a849043e25104e8b7ad0d4a96c525787b69379..a5e08c4703f202e30cdaf80ca3e7c00baa59c496
      2022-06-20 14:47:36 +0000 to 2022-06-23 20:12:03 +0000
      - Fix tests due to change in dead_code diagnostic. (rust-lang/cargo#10785)
      - Stabilize config-cli (rust-lang/cargo#10755)
      - Restrict duplicate deps warning only to published packages (rust-lang/cargo#10767)
      - Use fingerprint_hash when computing fingerprints for custom targets (rust-lang/cargo#10746)
      - Add preloading for workspace packages in `resolve_with_previous` (rust-lang/cargo#10761)
      - capitalise, for consistency (rust-lang/cargo#10772)
      - remove unused dependency from benchsuite (rust-lang/cargo#10774)
      - docs(contrib): Add documentation for ui tests (rust-lang/cargo#10758)
      fc96600b
    • B
      Auto merge of #98438 - compiler-errors:rollup-fudubjn, r=compiler-errors · e605a884
      bors 提交于
      Rollup of 16 pull requests
      
      Successful merges:
      
       - #96173 (Fix documentation for  `with_capacity` and `reserve` families of methods)
       - #98184 (Give name if anonymous region appears in impl signature)
       - #98259 (Greatly improve error reporting for futures and generators in `note_obligation_cause_code`)
       - #98269 (Provide a `PathSegment.res` in more cases)
       - #98283 (Point at private fields in struct literal)
       - #98305 (prohibit_generics: don't alloc error string if no error emitted)
       - #98310 (rustdoc: optimize loading of source sidebar)
       - #98353 (Migrate two diagnostics from the `rustc_builtin_macros` crate)
       - #98355 (Update no_default_libraries handling for emscripten target)
       - #98364 (clarify Arc::clone overflow check comment)
       - #98365 (Address review comments from #98259)
       - #98388 (implement `iter_projections` function on `PlaceRef`)
       - #98390 (Fixes handling of keywords in rustdoc json output)
       - #98409 (triagebot.toml: Allow applying nominated labels)
       - #98410 (Update books)
       - #98422 (Update browser-ui-test version to 0.9.6)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      e605a884
    • T
      Fix BTreeSet's range API panic message, document · 774e814b
      tnballo 提交于
      774e814b
    • A
      Update cargo · 7926ee4d
      Arlo Siemsen 提交于
      8 commits in 03a849043e25104e8b7ad0d4a96c525787b69379..a5e08c4703f202e30cdaf80ca3e7c00baa59c496
      2022-06-20 14:47:36 +0000 to 2022-06-23 20:12:03 +0000
      - Fix tests due to change in dead_code diagnostic. (rust-lang/cargo#10785)
      - Stabilize config-cli (rust-lang/cargo#10755)
      - Restrict duplicate deps warning only to published packages (rust-lang/cargo#10767)
      - Use fingerprint_hash when computing fingerprints for custom targets (rust-lang/cargo#10746)
      - Add preloading for workspace packages in `resolve_with_previous` (rust-lang/cargo#10761)
      - capitalise, for consistency (rust-lang/cargo#10772)
      - remove unused dependency from benchsuite (rust-lang/cargo#10774)
      - docs(contrib): Add documentation for ui tests (rust-lang/cargo#10758)
      7926ee4d
    • M
      Rollup merge of #98422 - GuillaumeGomez:browser-ui-test-update, r=Dylan-DPC · c9b16749
      Michael Goulet 提交于
      Update browser-ui-test version to 0.9.6
      
      This update provides a better error message when chromium crashes.
      
      cc ``@jsha``
      r? ``@Dylan-DPC``
      c9b16749
    • M
      Rollup merge of #98410 - ehuss:update-books, r=ehuss · 28b92bae
      Michael Goulet 提交于
      Update books
      
      ## reference
      
      6 commits in 683bfe5cd64d589c6a1645312ab5f93b6385ccbb..9fce337a55ee4a4629205f6094656195cecad231
      2022-05-27 11:54:20 -0700 to 2022-06-22 13:59:28 -0700
      - Remove outdated restriction on recursive types (rust-lang/reference#1231)
      - Clarify "string continue" for (byte) string literals (rust-lang/reference#1042)
      - Add a note to the turbofish section about impl Trait (rust-lang/reference#1212)
      - modify confusing variance example (rust-lang/reference#1224)
      - Add stable references of `macro_metavar_expr` (rust-lang/reference#1192)
      - Document native library modifier `bundle` (rust-lang/reference#1210)
      
      ## book
      
      33 commits in 396fdb69de7fb18f24b15c7ad13491b1c1fa7231..efbafdba3618487fbc9305318fcab9775132ac15
      2022-06-08 10:02:35 -0400 to 2022-06-19 21:06:50 -0400
      - Propagate tech review edits to appendices to src
      - Tech review comments and further edits to the appendices
      - Duplicate fragment "mutation and borrowing"
      - Propagate ch20 tech review edits to src
      - Edits in response to tech review of chapter 20
      - Comments from tech review on chapter 20
      - Propagate ch7 tech review edits to src
      - Responding to tech review of ch7
      - Tech review comments on ch7
      - Propagate ch19 tech review edits to src
      - Responses to tech review of ch19
      - Tech review comments on ch 19
      - Update ch03-01-variables-and-mutability.md
      - Add more explanation to CONTRIBUTING about the nostarch directory
      - Duplicate sentence
      - Missing period
      - Regenerate ch09-02 error messages
      - Change some print formatting styles in ch18
      - Propagate tech review ch18 edits to src
      - Responses to tech review comments of chapter 18
      - Chapter 18 from tech review
      - Snapshot of introduction for nostarch
      - Propagate edits of ch1 to src
      - Edits to edits to chapter 1
      - Edits from nostarch for chapter 1
      - Update Visual Studio instructions for 2022
      - bugfix/typo-ch10-01 Fix typo in chapter ch10-01
      - Tweak rustfmt slightly for these listings
      - Propagate edits to ch13 to src
      - Responses to nostarch edits to ch13
      - Edits to ch13 from nostarch
      - Apply complex Clippy recommendation
      - Apply Clippy recommendations: `cargo clippy --fix`
      
      ## rust-by-example
      
      4 commits in dbb7e5e2345ee26199ffba218156b6009016a20c..1095df2a5850f2d345fad43a30633133365875ba
      2022-06-02 16:30:51 -0300 to 2022-06-18 21:47:12 -0300
      - Add example for `array.get()` (rust-lang/rust-by-example#1554)
      - Example improvements (rust-lang/rust-by-example#1552)
      - Fix for a set of typos (rust-lang/rust-by-example#1551)
      - Make guard examples clearer around `_` (rust-lang/rust-by-example#1550)
      
      ## rustc-dev-guide
      
      11 commits in 6e4d6435db89bcc027b1bba9742e4f59666f5412..048d925f0a955aac601c4160c0e7f05771bcf63b
      2022-06-08 08:06:32 +0900 to 2022-06-21 22:25:34 +0900
      - not obvious what Ex is, so rather get rid (rust-lang/rustc-dev-guide#1372)
      - small improves (rust-lang/rustc-dev-guide#1371)
      - make clear that other versions can work (rust-lang/rustc-dev-guide#1373)
      - Fix small `src/diagnostics.md` typo (rust-lang/rustc-dev-guide#1370)
      - Add an "is" and rearange "We next" to "Next, we" (rust-lang/rustc-dev-guide#1369)
      - diagnostics: add translation documentation
      - diagnostics: line wrapping/heading changes
      - later -> latter
      - Remove mention of -Zborrowck=mir with Polonius. (rust-lang/rustc-dev-guide#1367)
      - Remove nll compare mode. (rust-lang/rustc-dev-guide#1366)
      - add section on user types (rust-lang/rustc-dev-guide#1359)
      
      ## embedded-book
      
      1 commits in cbb494f96da3268c2925bdadc65ca83d42f2d4ef..e17dcef5e96346ee3d7fa56820ddc7e5c39636bc
      2022-05-26 06:58:43 +0000 to 2022-06-19 10:28:00 +0000
      - Fix a typo  (rust-embedded/book#319)
      28b92bae
    • M
      Rollup merge of #98409 - joshtriplett:triagebot-nominated, r=Mark-Simulacrum · 8db945f0
      Michael Goulet 提交于
      triagebot.toml: Allow applying nominated labels
      8db945f0
    • M
      Rollup merge of #98390 - GuillaumeGomez:keyword-rustdoc-json, r=notriddle · 56209834
      Michael Goulet 提交于
      Fixes handling of keywords in rustdoc json output
      
      Fixes #98002.
      
      Instead of panicking, we just filter them out.
      
      cc ```@matthiaskrgr```
      r? ```@notriddle```
      56209834
    • M
      Rollup merge of #98388 - rosehuds:master, r=davidtwco · aafddd2a
      Michael Goulet 提交于
      implement `iter_projections` function on `PlaceRef`
      
      this makes the api more flexible. the original function now calls the PlaceRef
      version to avoid duplicating the code.
      aafddd2a
    • M
      Rollup merge of #98365 - jyn514:improve-obligation-errors-review-comments, r=eholk · 667a5462
      Michael Goulet 提交于
      Address review comments from #98259
      
      It got approved so fast I didn't have time to make changes xD
      
      r? ``@eholk``
      667a5462
    • M
      Rollup merge of #98364 - RalfJung:arc-clone, r=Mark-Simulacrum · e749ba20
      Michael Goulet 提交于
      clarify Arc::clone overflow check comment
      
      I had to read this twice to realize that this is explaining that the code is technically unsound, so move that into a dedicated paragraph and make the wording a bit more explicit.
      e749ba20
    • M
      Rollup merge of #98355 - hoodmane:emscripten-no-default, r=petrochenkov · cc45ad50
      Michael Goulet 提交于
      Update no_default_libraries handling for emscripten target
      
      ```@sbc100``` says:
      
      > `-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]` is almost certainly wrong/out-of-date.   This setting defaults to the empty list anyway these days so its redundant.  Also we now support `-nodefaultlibs` so you can use that, as with other toolchains.
      
      https://github.com/rust-lang/rust/issues/98303#issuecomment-1162163684
      cc45ad50
    • M
      Rollup merge of #98353 - beetrees:builtin-macros-cfg-diag, r=davidtwco · 21085e91
      Michael Goulet 提交于
      Migrate two diagnostics from the `rustc_builtin_macros` crate
      
      Migrate two diagnostics to use the struct derive and be translatable.
      
      r? ```@davidtwco```
      21085e91
    • M
      Rollup merge of #98310 - jsha:defer-source-sidebar, r=GuillaumeGomez · cc95225f
      Michael Goulet 提交于
      rustdoc: optimize loading of source sidebar
      
      The source sidebar has a setting to remember whether it should be open or
      closed. Previously, this setting was handled in source-script.js, which
      is loaded with `defer`, meaning it is often run after the document is rendered.
      Since CSS renders the source sidebar as closed by default, changing this
      after the initial render results in a relayout.
      
      Instead, handle the setting in storage.js, which is the first script to load
      and is the only script that blocks render. This avoids a relayout and means
      navigating between files with the sidebar open is faster.
      
      Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html
      
      r? ````@GuillaumeGomez````
      cc95225f
    • M
      Rollup merge of #98305 - klensy:no-err-alloc, r=compiler-errors · 0ed2feca
      Michael Goulet 提交于
      prohibit_generics: don't alloc error string if no error emitted
      
      Noticed unreaded allocs in DHAT.
      0ed2feca
    • M
      Rollup merge of #98283 - TaKO8Ki:point-at-private-fields-in-struct-literal, r=compiler-errors · 41cb5e94
      Michael Goulet 提交于
      Point at private fields in struct literal
      
      closes #95872
      41cb5e94
    • M
      Rollup merge of #98269 - compiler-errors:provide-more-segment-res, r=petrochenkov · 3b68700d
      Michael Goulet 提交于
      Provide a `PathSegment.res` in more cases
      
      I find that in many cases, the `res` associated with a `PathSegment` is `Res::Err` even though the path was fully resolved. A few diagnostics use this `res` and their error messages suffer because of the lack of resolved segment.
      
      This fixes it a bit, but it's obviously not complete and I'm not exactly sure if it's correct.
      3b68700d
    • M
      Rollup merge of #98259 - jyn514:improve-obligation-errors, r=estebank · 413e350f
      Michael Goulet 提交于
      Greatly improve error reporting for futures and generators in `note_obligation_cause_code`
      
      Most futures don't go through this code path, because they're caught by
      `maybe_note_obligation_cause_for_async_await`. But all generators do,
      and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses.
      
      At some point, we may want to consider unifying this with the code for `maybe_note_async_await`,
      so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points.
      But both functions are quite complicated, and it's not clear to me how to combine them;
      this seems like a good incremental improvement.
      
      Helps with https://github.com/rust-lang/rust/issues/97332.
      
      r? ``@estebank`` cc ``@eholk`` ``@compiler-errors``
      413e350f
    • M
      Rollup merge of #98184 - compiler-errors:elided-lifetime-in-impl-nll, r=cjgillot · 49bcc705
      Michael Goulet 提交于
      Give name if anonymous region appears in impl signature
      
      Fixes #98170
      
      We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
      49bcc705
    • M
      Rollup merge of #96173 - jmaargh:jmaargh/with-capacity-doc-fix, r=Dylan-DPC · 262382ff
      Michael Goulet 提交于
      Fix documentation for  `with_capacity` and `reserve` families of methods
      
      Fixes #95614
      
      Documentation for the following methods
       - `with_capacity`
       - `with_capacity_in`
       - `with_capacity_and_hasher`
       - `reserve`
       - `reserve_exact`
       - `try_reserve`
       - `try_reserve_exact`
      
      was inconsistent and often not entirely correct where they existed on the following types
      - `Vec`
      - `VecDeque`
      - `String`
      - `OsString`
      - `PathBuf`
      - `BinaryHeap`
      - `HashSet`
      - `HashMap`
      - `BufWriter`
      - `LineWriter`
      
      since the allocator is allowed to allocate more than the requested capacity in all such cases, and will frequently "allocate" much more in the case of zero-sized types (I also checked `BufReader`, but there the docs appear to be accurate as it appears to actually allocate the exact capacity).
      
      Some effort was made to make the documentation more consistent between types as well.
      262382ff
    • N
      add regression tests found in crater · e7ed8fe4
      Niko Matsakis 提交于
      e7ed8fe4
    • N
      run `x.py fmt` · e93e1051
      Niko Matsakis 提交于
      e93e1051
    • N
      remove misleading comment · 9118fafd
      Niko Matsakis 提交于
      per aliemjay's suggestion
      9118fafd
    • N
      try to clarify confusing comment · d8337ee2
      Niko Matsakis 提交于
      d8337ee2
    • N
      normalize if-eq bounds before testing · c3137d9e
      Niko Matsakis 提交于
      Hat-tip: aliemjay
      c3137d9e
    • N
      apply suggestions from oli-obk · e6b630c5
      Niko Matsakis 提交于
      Co-authored-by: NOli Scherer <github35764891676564198441@oli-obk.de>
      e6b630c5
    • N
      coallesce docs · c9bf88cc
      Niko Matsakis 提交于
      c9bf88cc