1. 02 10月, 2020 1 次提交
  2. 01 10月, 2020 39 次提交
    • B
      Auto merge of #76919 - fusion-engineering-forks:thread-parker, r=dtolnay · 78201356
      bors 提交于
      Use futex-based thread::park/unpark on Linux.
      
      This moves the parking/unparking logic out of `thread/mod.rs` into a module named `thread_parker` in `sys_common`. The current implementation is moved to `sys_common/thread_parker/generic.rs` and the new implementation using futexes is added in `sys_common/thread_parker/futex.rs`.
      78201356
    • B
      Auto merge of #74839 - alarsyo:multiple_return_terminators, r=oli-obk · 9cba260d
      bors 提交于
      Implement multiple return terminator optimization
      
      Closes #72022
      9cba260d
    • A
      Bless mir-opt tests for 32 bit · 46c0bd31
      Antoine Martin 提交于
      46c0bd31
    • A
      Add test for multiple terminator optimization · 268f786d
      Antoine Martin 提交于
      268f786d
    • A
      Bless mir-opt tests with new opt · f0d407ed
      Antoine Martin 提交于
      f0d407ed
    • A
      Implement multiple return terminators optimization · f54bfac0
      Antoine Martin 提交于
      f54bfac0
    • B
      Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=oli-obk · fc42fb8e
      bors 提交于
      Overhaul const-checking diagnostics
      
      The primary purpose of this PR was to remove `NonConstOp::STOPS_CONST_CHECKING`, which causes any additional errors found by the const-checker to be silenced. I used this flag to preserve diagnostic parity with `qualify_min_const_fn.rs`, which has since been removed.
      
      However, simply removing the flag caused a deluge of errors in some cases, since an error would be emitted any time a local or temporary had a wrong type. To remedy this, I added an alternative system (`DiagnosticImportance`) to silence additional error messages that were likely to distract the user from the underlying issue. When an error of the highest importance occurs, all less important errors are silenced. When no error of the highest importance occurs, all less important errors are emitted after checking is complete. Following the suggestions from the important error is usually enough to fix the less important errors, so this should lead to better UX most of the time.
      
      There's also some unrelated diagnostics improvements in this PR isolated in their own commits. Splitting them out would be possible, but a bit of a pain. This isn't as tidy as some of my other PRs, but it should *only* affect diagnostics, never whether or not something passes const-checking. Note that there are a few trivial exceptions to this, like banning `Yield` in all const-contexts, not just `const fn`.
      
      As always, meant to be reviewed commit-by-commit.
      
      r? `@oli-obk`
      fc42fb8e
    • B
      Auto merge of #77383 - pickfire:patch-6, r=Mark-Simulacrum · 00730fd0
      bors 提交于
      Fix typo in vec doc "tries to reserves"
      
      Superseeds #77192
      00730fd0
    • B
      Auto merge of #77379 - camelid:improve-wording-crate-resolution-error, r=davidtwco · 3bbc443c
      bors 提交于
      Improve wording for external crate resolution error
      
      I think it reads better this way.
      3bbc443c
    • I
      Fix typo in vec doc "tries to reserves" · 86e30b60
      Ivan Tham 提交于
      86e30b60
    • B
      Auto merge of #77381 - Dylan-DPC:rollup-0sr6p5p, r=Dylan-DPC · b218b952
      bors 提交于
      Rollup of 12 pull requests
      
      Successful merges:
      
       - #76909 (Add Iterator::advance_by and DoubleEndedIterator::advance_back_by)
       - #77153 (Fix recursive nonterminal expansion during pretty-print/reparse check)
       - #77202 (Defer Apple SDKROOT detection to link time.)
       - #77303 (const evaluatable: improve `TooGeneric` handling)
       - #77305 (move candidate_from_obligation_no_cache)
       - #77315 (Rename AllocErr to AllocError)
       - #77319 (Stable hashing: add comments and tests concerning platform-independence)
       - #77324 (Don't fire `const_item_mutation` lint on writes through a pointer)
       - #77343 (Validate `rustc_args_required_const`)
       - #77349 (Update cargo)
       - #77360 (References to ZSTs may be at arbitrary aligned addresses)
       - #77371 (Remove trailing space in error message)
      
      Failed merges:
      
      r? `@ghost`
      b218b952
    • D
      Rollup merge of #77371 - camelid:remove-extra-space-in-diagnostic, r=varkor · 85e77edc
      Dylan DPC 提交于
      Remove trailing space in error message
      
      - Add test for error message
      - Remove trailing space in error message
      85e77edc
    • D
      Rollup merge of #77360 - oli-obk:zst_const_pat_regression, r=RalfJung · cc1513b8
      Dylan DPC 提交于
      References to ZSTs may be at arbitrary aligned addresses
      
      fixes #77320
      
      r? @RalfJung
      cc1513b8
    • D
      Rollup merge of #77349 - ehuss:update-cargo, r=ehuss · ffb771bc
      Dylan DPC 提交于
      Update cargo
      
      8 commits in 05c611ae3c4255b7a2bcf4fcfa65b20286a07839..75615f8e69f748d7ef0df7bc0b064a9b1f5c78b2
      2020-09-23 23:10:38 +0000 to 2020-09-29 18:42:19 +0000
      - Correct mistake about supporting sub-makes and document CARGO_MAKEFLAGS (rust-lang/cargo#8741)
      - Properly set for_host for proc-macro tests. (rust-lang/cargo#8742)
      - Add Zsh completion for target triples (rust-lang/cargo#8740)
      - Reinitialize index on "Object not found" error. (rust-lang/cargo#8735)
      - Normalize raw string indentation. (rust-lang/cargo#8739)
      - Update links to rustup docs. (rust-lang/cargo#8738)
      - Add contributor guide. (rust-lang/cargo#8715)
      - Fix minor error in `cargo update` docs. (rust-lang/cargo#8737)
      ffb771bc
    • D
      Rollup merge of #77343 - varkor:rustc_args_required_const-validation, r=lcnr · 849e5636
      Dylan DPC 提交于
      Validate `rustc_args_required_const`
      
      Fixes https://github.com/rust-lang/rust/issues/74608.
      849e5636
    • D
      Rollup merge of #77324 - Aaron1011:fix/const-item-mutation-ptr, r=petrochenkov · 73258f87
      Dylan DPC 提交于
      Don't fire `const_item_mutation` lint on writes through a pointer
      
      Fixes #77321
      73258f87
    • D
      Rollup merge of #77319 - tgnottingham:siphasher_endianness, r=nnethercote · 0044a9c0
      Dylan DPC 提交于
      Stable hashing: add comments and tests concerning platform-independence
      
      SipHasher128 implements short_write in an endian-independent way, yet
      its write_xxx Hasher trait methods undo this endian-independence by byte
      swapping the integer inputs on big-endian hardware. StableHasher then
      adds endian-independence back by also byte-swapping on big-endian
      hardware prior to invoking SipHasher128.
      
      This double swap may have the appearance of being a no-op, but is in
      fact by design. In particular, we really do want SipHasher128 to be
      platform-dependent, in order to be consistent with the libstd SipHasher.
      Try to clarify this intent. Also, add and update a couple of unit tests.
      
      ---
      
      Previous commit text:
      
      ~SipHasher128: fix platform-independence confusion~
      
      ~StableHasher is supposed to ensure platform independence by converting
      integers to little-endian and extending isize and usize to 64 bits as
      necessary, but in fact, much of that work is already handled by
      SipHasher128.~
      
      ~In particular, SipHasher128 implements short_write in an
      endian-independent way, yet both StableHasher and SipHasher128
      additionally attempt to achieve endian-independence by byte swapping on
      BE hardware before invoking short writes. This double swap has no
      effect, so let's remove it.~
      
      ~Because short_write is endian-independent, SipHasher128 is already
      handling part of the platform-independence, and it would be somewhat
      difficult to make it *not* handle that part with the current
      implementation. As splitting platform-independence responsibilities
      between StableHasher and SipHasher128 would be confusing, let's make
      SipHasher128 handle all of it.~
      
      ~Finally, update some incorrect comments and increase test coverage.
      Unit tests pass on both LE and BE systems.~
      0044a9c0
    • D
      Rollup merge of #77315 - exrook:rename-allocerror, r=joshtriplett · 70740b1b
      Dylan DPC 提交于
      Rename AllocErr to AllocError
      
      Implements rust-lang/wg-allocators#57
      70740b1b
    • D
      Rollup merge of #77305 - lcnr:candidate_from_obligation, r=davidtwco · 6d3cfd9d
      Dylan DPC 提交于
      move candidate_from_obligation_no_cache
      
      It's only called from `candidate_from_obligation` which is already in this file.
      6d3cfd9d
    • D
      Rollup merge of #77303 - lcnr:const-evaluatable-TooGeneric, r=oli-obk,varkor · f2355945
      Dylan DPC 提交于
      const evaluatable: improve `TooGeneric` handling
      
      Instead of emitting an error in `fulfill`, we now correctly stall on inference variables.
      
      As `const_eval_resolve` returns `ErrorHandled::TooGeneric` when encountering generic parameters on which
      we actually do want to error, we check for inference variables and eagerly emit an error if they don't exist, returning `ErrorHandled::Reported` instead.
      
      Also contains a small bugfix for `ConstEquate` where we previously only stalled on type variables. This is probably a leftover from
      when we did not yet support stalling on const inference variables.
      
      r? @oli-obk cc @varkor @EddyB
      f2355945
    • D
      Rollup merge of #77202 - ehuss:defer-apple-sdkroot, r=petrochenkov · 37df40bd
      Dylan DPC 提交于
      Defer Apple SDKROOT detection to link time.
      
      This defers the detection of the SDKROOT for Apple iOS/tvOS targets to link time, instead of when the `Target` is defined. This allows commands that don't need to link to work (like `rustdoc` or `rustc --print=target-list`). This also makes `--print=target-list` a bit faster.
      
      This also removes the note in the platform support documentation about these targets being missing. When I wrote it, I misunderstood how the SDKROOT stuff worked.
      
      Notes:
      * This means that JSON spec targets can't explicitly override these flags. I think that is probably fine, as I believe the value is generally required, and can be set with the SDKROOT environment variable.
      * This changes `x86_64-apple-tvos` to use `appletvsimulator`. I think the original code was wrong (it was using `iphonesimulator`). Also, `x86_64-apple-tvos` seems broken in general, and I cannot build it locally. The `data_layout` does not appear to be correct (it is a copy of the arm64 layout instead of the x86_64 layout). I have not tried building Apple's LLVM to see if that helps, but I suspect it is just wrong (I'm uncertain since I don't know how the tvOS simulator works with its bitcode-only requirements).
      * I'm tempted to remove the use of `Result` for built-in target definitions, since I don't think they should be fallible. This was added in https://github.com/rust-lang/rust/pull/34980, but that only relates to JSON definitions. I think the built-in targets shouldn't fail. I can do this now, or not.
      
      Fixes #36156
      Fixes #76584
      37df40bd
    • D
      Rollup merge of #77153 - Aaron1011:fix/better-recursive-expand, r=petrochenkov · 8ccc063f
      Dylan DPC 提交于
      Fix recursive nonterminal expansion during pretty-print/reparse check
      
      Makes progress towards #43081
      
      In PR #73084, we started recursively expanded nonterminals during the
      pretty-print/reparse check, allowing them to be properly compared
      against the reparsed tokenstream.
      
      Unfortunately, the recursive logic in that PR only handles the case
      where a nonterminal appears inside a `TokenTree::Delimited`. If a
      nonterminal appears directly in the expanded tokens of another
      nonterminal, the inner nonterminal will not be expanded.
      
      This PR fixes the recursive expansion of nonterminals, ensuring that
      they are expanded wherever they occur.
      8ccc063f
    • D
      Rollup merge of #76909 - timvermeulen:advance_by, r=Amanieu · 8bd4ed9f
      Dylan DPC 提交于
      Add Iterator::advance_by and DoubleEndedIterator::advance_back_by
      
      This PR adds the iterator method
      
      ```rust
      fn advance_by(&mut self, n: usize) -> Result<(), usize>
      ```
      
      that advances the iterator by `n` elements, returning `Ok(())` if this succeeds or `Err(len)` if the length of the iterator was less than `n`.
      
      Currently `Iterator::nth` is the method to override for efficiently advancing an iterator by multiple elements at once. `advance_by` is superior for this purpose because
      - it's simpler to implement: instead of advancing the iterator and producing the next element you only need to advance the iterator
      - it composes better: iterators like `Chain` and `FlatMap` can implement `advance_by` in terms of `advance_by` on their inner iterators, but they cannot implement `nth` in terms of `nth` on their inner iterators (see #60395)
      - the default implementation of `nth` can trivially be implemented in terms of `advance_by` and `next`, which this PR also does
      
      This PR also adds `DoubleEndedIterator::advance_back_by` for all the same reasons.
      
      I'll make a tracking issue if it's decided this is worth merging. Also let me know if anything can be improved, this went through several iterations so there might very well still be room for improvement (especially in the doc comments). I've written overrides of these methods for most iterators that already override `nth`/`nth_back`, but those still need tests so I'll add them in a later PR.
      
      cc @cuviper @scottmcm @Amanieu
      8bd4ed9f
    • B
      Auto merge of #76325 - lzutao:split-core-str, r=Amanieu · 9bb55dc8
      bors 提交于
      Split core/str/mod.rs to smaller files
      
      Note for reviewer:
      * I split to multiple commits for easier reviewing, but I could git squash them all to one if requested.
      * Recommend pulling this change locally and using advanced git diff viewer or this command:
        ```bash
        git show --reverse --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space master..
        ```
      
      ---
      
      I split `core/str/mod.rs` to these modules:
      
      * `converts`: Contains helper functions to convert from bytes to str.
      * `error`: For error structs like Utf8Error.
      * `iter`: For iterators of many str methods.
      * `traits`: For indexing operations and build in traits on str.
      * `validations`: For functions validating utf8 --- This name is awkward, maybe utf8.rs is better.
      9bb55dc8
    • C
      Improve wording for external crate resolution error · 2c5e2a6f
      Camelid 提交于
      I think it reads better this way.
      2c5e2a6f
    • B
      Auto merge of #77372 - jonas-schievink:rollup-e5bdzga, r=jonas-schievink · ef663a8a
      bors 提交于
      Rollup of 12 pull requests
      
      Successful merges:
      
       - #77037 (more tiny clippy cleanups)
       - #77233 (BTreeMap: keep an eye out on the size of the main components)
       - #77280 (Ensure that all LLVM components requested by tests are available on CI)
       - #77284 (library: Forward compiler-builtins "mem" feature)
       - #77296 (liveness: Use Option::None to represent absent live nodes)
       - #77322 (Add unstable book docs for `-Zunsound-mir-opts`)
       - #77328 (Use `rtassert!` instead of `assert!` from the child process after fork() in std::sys::unix::process::Command::spawn())
       - #77331 (Add test for async/await combined with const-generics.)
       - #77338 (Fix typo in alloc vec comment)
       - #77340 (Alloc vec use imported path)
       - #77345 (Add test for issue #74761)
       - #77348 (Update books)
      
      Failed merges:
      
      r? `@ghost`
      ef663a8a
    • J
      Rollup merge of #77348 - ehuss:update-books, r=ehuss · 3624a901
      Jonas Schievink 提交于
      Update books
      
      ## rust-by-example
      
      5 commits in 19f0a0372af497b34369cf182d9d16156cab2969..7d3ff1c12db08a847a57a054be4a7951ce532d2d
      2020-08-26 09:38:48 -0300 to 2020-09-28 15:54:25 -0300
      - Prevent duplicated error information in "wrapping errors" example (rust-lang/rust-by-example#1375)
      - Avoid lifetime annotation in struct example (rust-lang/rust-by-example#1378)
      - Clone.md comment and variable name change (rust-lang/rust-by-example#1379)
      - Replace panic example with a simpler version (rust-lang/rust-by-example#1380)
      - Prefer `const` over `static` (rust-lang/rust-by-example#1381)
      
      ## embedded-book
      
      1 commits in 0cd2ca116274b915924c3a7e07c1e046b6f19b77..dd310616308e01f6cf227f46347b744aa56b77d9
      2020-08-19 10:33:15 +0000 to 2020-09-26 08:54:08 +0000
      - Add instructions for ARM v8 instruction sets  (rust-embedded/book#265)
      3624a901
    • J
      Rollup merge of #77345 - samlich:test-issue-74761, r=lcnr · 4202c60a
      Jonas Schievink 提交于
      Add test for issue #74761
      
      Adds test for and closes #74761 which previously crashed compiler.
      4202c60a
    • J
      Rollup merge of #77340 - pickfire:patch-9, r=kennytm · fea2ad8a
      Jonas Schievink 提交于
      Alloc vec use imported path
      
      mem::ManuallyDrop::new -> ManuallyDrop::new
      
      cc @the8472
      fea2ad8a
    • J
      Rollup merge of #77338 - pickfire:patch-7, r=jyn514 · 054ba3db
      Jonas Schievink 提交于
      Fix typo in alloc vec comment
      
      cc @the8472
      054ba3db
    • J
      Rollup merge of #77331 - hameerabbasi:issue-74906, r=lcnr · 4e517830
      Jonas Schievink 提交于
      Add test for async/await combined with const-generics.
      
      Fixes #74906.
      4e517830
    • J
      Rollup merge of #77328 - hyd-dev:assert-to-rtassert, r=Amanieu · c46f5784
      Jonas Schievink 提交于
      Use `rtassert!` instead of `assert!` from the child process after fork() in std::sys::unix::process::Command::spawn()
      
      As discussed in #73894, `assert!` panics on failure, which is not signal-safe, and `rtassert!` is a suitable replacement.
      
      Fixes #73894.
      
      r? @Amanieu @cuviper @joshtriplett
      c46f5784
    • J
      Rollup merge of #77322 - rust-lang:wesleywiser-patch-1, r=steveklabnik · b85081d4
      Jonas Schievink 提交于
      Add unstable book docs for `-Zunsound-mir-opts`
      
      The `-Zunsound-mir-opts` flag was added in #76899.
      b85081d4
    • J
      Rollup merge of #77296 - tmiasko:liveness-option, r=ecstatic-morse · d4add198
      Jonas Schievink 提交于
      liveness: Use Option::None to represent absent live nodes
      
      No functional changes intended.
      d4add198
    • J
      Rollup merge of #77284 - josephlr:mem, r=Mark-Simulacrum · 87387fd2
      Jonas Schievink 提交于
      library: Forward compiler-builtins "mem" feature
      
      This fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/53
      
      Now users will be able to do:
      ```
      cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem
      ```
      and correctly get the Rust implemenations for `memcpy` and friends.
      Signed-off-by: NJoe Richey <joerichey@google.com>
      87387fd2
    • J
      Rollup merge of #77280 - petrochenkov:llvmcomp, r=Mark-Simulacrum · a4dc8dae
      Jonas Schievink 提交于
      Ensure that all LLVM components requested by tests are available on CI
      
      Addresses https://github.com/rust-lang/rust/pull/75064#issuecomment-667722652
      
      I used an environment variable because passing a command line option all the way from CI to compiletest would be just too much hassle for this task.
      I added a new variable, but any of the already existing ones defined by CI could be used instead.
      r? @Mark-Simulacrum
      a4dc8dae
    • J
      Rollup merge of #77233 - ssomers:btree_size_matters, r=Mark-Simulacrum · 7ad03dd9
      Jonas Schievink 提交于
      BTreeMap: keep an eye out on the size of the main components
      
      r? @Mark-Simulacrum
      7ad03dd9
    • J
      Rollup merge of #77037 - matthiaskrgr:cl42ppy, r=Dylan-DPC · 248d6bf1
      Jonas Schievink 提交于
      more tiny clippy cleanups
      
      commits stand alone and can be reviewed one by one
      248d6bf1
    • C
      Remove trailing space in error message · b2ce3e53
      Camelid 提交于
      b2ce3e53