Commit graph

128811 commits

Author SHA1 Message Date
Pietro Albini
fde1135916
build-manifest: avoid collecting SHAs in parallel on legacy mode
This avoids overloading the old server, and disrupting the other
programs running on it.
2020-10-01 17:30:24 +02:00
Pietro Albini
acd8e59b66
build-manifest: calculate checksums lazily and in parallel
This commit improves the way build-manifest calculates the checksums
included in the manifest, speeding it up:

* Instead of calculating all the hashes beforehand and then using the
  ones we need, the manifest is first generated with placeholder hashes,
  and then a function walks through the manifest and calculates only the
  needed checksums.

* Calculating the checksums is now done in parallel with rayon, to
  better utilize all the available disk bandwidth.

* Calculating the checksums now uses the sha2 crate instead of the
  sha256sum CLI tool: this avoids the overhead of calling another
  process, but more importantly uses hardware acceleration whenever
  available (the CLI tool doesn't support it at all).
2020-10-01 17:30:24 +02:00
Pietro Albini
0375ee8b55
build-manifest: move generating a target to the manifest mod 2020-10-01 17:02:47 +02:00
Tim Vermeulen
4404c1afae Add tracking issue 2020-10-01 16:52:22 +02:00
Mara Bos
63b6007d5b Work around potential merging/duplication issues in sys/windows/compat. 2020-10-01 16:52:11 +02:00
Mara Bos
09cbaf4367 Formatting. 2020-10-01 16:08:58 +02:00
Mara Bos
93310efdbe Use AcquireSRWLockExclusive::is_available() instead of an extra lookup. 2020-10-01 16:08:58 +02:00
Mara Bos
8b2bdfd453 Improve std::sys::windows::compat.
- Module name can now be any string, not just an ident.
  (Not all Windows api modules are valid Rust identifiers.)
- Adds c::FuncName::is_available() for checking if a function is really
  available without having to do a duplicate lookup.
- Add comment explaining the lack of locking.
- Use `$_:block` to simplify the macro_rules.
- Apply allow(unused_variables) only to the fallback instead of
  everything.
2020-10-01 16:08:57 +02:00
Dániel Buga
de623bfaf7 Only test on x86_64 2020-10-01 16:02:32 +02:00
bors
782013564e Auto merge of #76919 - fusion-engineering-forks:thread-parker, r=dtolnay
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`.
2020-10-01 13:21:34 +00:00
Stein Somers
424347527d BTreeMap: use Unique::from to avoid a cast where type information exists 2020-10-01 15:03:51 +02:00
Stein Somers
df76cf89ad BTreeMap: admit the existence of leaf edges in comments 2020-10-01 13:20:39 +02:00
bors
9cba260df0 Auto merge of #74839 - alarsyo:multiple_return_terminators, r=oli-obk
Implement multiple return terminator optimization

Closes #72022
2020-10-01 09:52:58 +00:00
Antoine Martin
46c0bd3182 Bless mir-opt tests for 32 bit 2020-10-01 10:27:28 +02:00
Antoine Martin
268f786d3c Add test for multiple terminator optimization 2020-10-01 10:08:09 +02:00
Antoine Martin
f0d407ed0f Bless mir-opt tests with new opt 2020-10-01 10:07:04 +02:00
Antoine Martin
f54bfac074 Implement multiple return terminators optimization 2020-10-01 10:06:37 +02:00
bors
fc42fb8e70 Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=oli-obk
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`
2020-10-01 07:38:47 +00:00
scottmcm
e58f3d352d
Things are only moved if non-copy 2020-10-01 07:04:20 +00:00
Oliver Scherer
8f9472cc9e Only mention that a stack frame is being popped when starting to do so 2020-10-01 08:32:24 +02:00
bors
00730fd0f1 Auto merge of #77383 - pickfire:patch-6, r=Mark-Simulacrum
Fix typo in vec doc "tries to reserves"

Superseeds #77192
2020-10-01 05:35:48 +00:00
Joshua Nelson
8164218181 Fix some clippy issues
Found while working on https://github.com/rust-lang/rust/pull/77351;
these are just the ones that could be fixed automatically.
2020-10-01 01:34:38 -04:00
David Tolnay
75c2fdf34a
Warn on method call mutating const, even if it has destructor 2020-09-30 22:19:45 -07:00
David Tolnay
eef5104c53
Add test of VEC.push on a const 2020-09-30 22:19:39 -07:00
Yuki Okushi
38f460f866 Add a regression test for issue-75299 2020-10-01 14:10:53 +09:00
Yuki Okushi
d4fdf6e754 Add a regression test for issue-74244 2020-10-01 14:10:44 +09:00
Yuki Okushi
50ffd6b7cb Add a regression test for issue-72565 2020-10-01 14:10:33 +09:00
Yuki Okushi
8631e1c575 Add a regression test for issue-68951 2020-10-01 14:10:23 +09:00
Yuki Okushi
c1e17f56ea Add a regression test for issue-66501 2020-10-01 14:09:57 +09:00
David Tolnay
41baa090ad
Skip dropck::check_drop_impl in is_const_item_without_destructor
adt_destructor by default also validates the Drop impl using
dropck::check_drop_impl, which contains an expect_local(). This
leads to ICE in check_const_item_mutation if the const's type is
not a local type.

    thread 'rustc' panicked at 'DefId::expect_local: `DefId(5:4805 ~ alloc[d7e9]::vec::{impl#50})` isn't local', compiler/rustc_span/src/def_id.rs:174:43
    stack backtrace:
       0: rust_begin_unwind
       1: rustc_span::def_id::DefId::expect_local::{{closure}}
       2: rustc_typeck::check::dropck::check_drop_impl
       3: rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::calculate_dtor::{{closure}}
       4: rustc_middle::ty::trait_def::<impl rustc_middle::ty::context::TyCtxt>::for_each_relevant_impl
       5: rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::calculate_dtor
       6: rustc_typeck::check::adt_destructor
       7: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::adt_destructor>::compute
       8: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
       9: rustc_query_system::query::plumbing::get_query_impl
      10: rustc_mir::transform::check_const_item_mutation::ConstMutationChecker::is_const_item_without_destructor
2020-09-30 21:58:13 -07:00
David Tolnay
352ce8b299
Test a type with drop glue but no Drop impl 2020-09-30 21:58:07 -07:00
David Tolnay
0f6284c88d
Add test of const item mutation with Drop impl 2020-09-30 21:57:37 -07:00
David Tolnay
bb760b53bf
Simplify defid destructor check 2020-09-30 21:45:56 -07:00
David Tolnay
0dfe7b6434
Add justification of the destructor filter 2020-09-30 21:45:56 -07:00
David Tolnay
17db1cb5d5
Bypass const_item_mutation if const's type has Drop impl 2020-09-30 21:45:56 -07:00
bors
3bbc443cc6 Auto merge of #77379 - camelid:improve-wording-crate-resolution-error, r=davidtwco
Improve wording for external crate resolution error

I think it reads better this way.
2020-10-01 03:28:50 +00:00
Scott McMurray
20202da09e Improve the example for ptr::copy
Fixes #77220
2020-09-30 20:00:09 -07:00
Ivan Tham
86e30b605c
Fix typo in vec doc "tries to reserves" 2020-10-01 10:08:51 +08:00
Carol (Nichols || Goulding)
2033eb1495
Write manifest for MAJOR.MINOR channel to enable rustup convenience
This connects to https://github.com/rust-lang/rustup/issues/794.

It's hard to remember if there have been patch releases for old versions
when you'd like to install the latest in a MAJOR.MINOR series.

When we're doing a stable release, we write duplicate manifests to
`stable`. With this change, only when we're doing a stable release, also
write duplicate manifests to `MAJOR.MINOR` to eventually enable rustup
(and any other tooling that builds Rust release URLs) to request, say,
`1.45` and get `1.45.2` (assuming `1.45.2` is the latest available
`1.45` and assuming that we never publish patch releases out of order).
2020-09-30 21:27:04 -04:00
bors
b218b952f8 Auto merge of #77381 - Dylan-DPC:rollup-0sr6p5p, r=Dylan-DPC
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`
2020-10-01 01:12:41 +00:00
Dylan DPC
85e77edc82
Rollup merge of #77371 - camelid:remove-extra-space-in-diagnostic, r=varkor
Remove trailing space in error message

- Add test for error message
- Remove trailing space in error message
2020-10-01 02:13:49 +02:00
Dylan DPC
cc1513b860
Rollup merge of #77360 - oli-obk:zst_const_pat_regression, r=RalfJung
References to ZSTs may be at arbitrary aligned addresses

fixes #77320

r? @RalfJung
2020-10-01 02:13:48 +02:00
Dylan DPC
ffb771bc79
Rollup merge of #77349 - ehuss:update-cargo, r=ehuss
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)
2020-10-01 02:13:46 +02:00
Dylan DPC
849e5636ea
Rollup merge of #77343 - varkor:rustc_args_required_const-validation, r=lcnr
Validate `rustc_args_required_const`

Fixes https://github.com/rust-lang/rust/issues/74608.
2020-10-01 02:13:44 +02:00
Dylan DPC
73258f87ea
Rollup merge of #77324 - Aaron1011:fix/const-item-mutation-ptr, r=petrochenkov
Don't fire `const_item_mutation` lint on writes through a pointer

Fixes #77321
2020-10-01 02:13:43 +02:00
Dylan DPC
0044a9c084
Rollup merge of #77319 - tgnottingham:siphasher_endianness, r=nnethercote
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.~
2020-10-01 02:13:41 +02:00
Dylan DPC
70740b1b82
Rollup merge of #77315 - exrook:rename-allocerror, r=joshtriplett
Rename AllocErr to AllocError

Implements rust-lang/wg-allocators#57
2020-10-01 02:13:39 +02:00
Dylan DPC
6d3cfd9d51
Rollup merge of #77305 - lcnr:candidate_from_obligation, r=davidtwco
move candidate_from_obligation_no_cache

It's only called from `candidate_from_obligation` which is already in this file.
2020-10-01 02:13:37 +02:00
Dylan DPC
f23559451b
Rollup merge of #77303 - lcnr:const-evaluatable-TooGeneric, r=oli-obk,varkor
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
2020-10-01 02:13:35 +02:00
Dylan DPC
37df40bd1c
Rollup merge of #77202 - ehuss:defer-apple-sdkroot, r=petrochenkov
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
2020-10-01 02:13:34 +02:00