Commit graph

128836 commits

Author SHA1 Message Date
Waffle 1c2c336dbc Link new method in DefautHashers doc 2020-10-02 00:30:19 +03:00
David Tolnay 804d159c62
Fixme with link for re-enabling const mutation lint for Drop consts 2020-10-01 13:41:43 -07:00
LeSeulArtichaut 4bf5c45865 Remove outdated line from publish_toolstate hook 2020-10-01 22:30:11 +02:00
Michael Howell cd159fd7f9 Uplift drop-bounds lint from clippy 2020-10-01 12:06:33 -07:00
Guillaume Gomez 8b7aeefede Import struct_span_err macro instead of prepending it 2020-10-01 20:41:57 +02:00
Guillaume Gomez de21c3df0e Create E0777 error code for "invalid literal in derive" 2020-10-01 20:41:57 +02:00
Dylan MacKenzie 6691d11234 Add -Zprecise-enum-drop-elaboration
Its purpose is to assist in debugging #77382 and #74551.
2020-10-01 11:31:43 -07:00
bors 8fe73e80d7 Auto merge of #76971 - bugadani:issue-75659, r=Amanieu
Refactor memchr to allow optimization

Closes #75659

The implementation already uses naive search if the slice if short enough, but the case is complicated enough to not be optimized away. This PR refactors memchr so that it exists early when the slice is short enough.

Codegen-wise, as shown in #75659, memchr was not inlined previously so the only way I could find to test this is to check if there is no memchr call. Let me know if there is a more robust solution here.
2020-10-01 18:16:02 +00:00
Pietro Albini 9352062bc3
build-manifest: use BufReader 2020-10-01 19:42:02 +02:00
Pietro Albini b710f9c5d5
ci: switch to environment files to change the environment on GHA
See GitHub's blog post on why the change was necessary:

    https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2020-10-01 19:26:50 +02:00
Ivan Tham aea3f8dbc9
Remove trailing whitespace in iter chain doc 2020-10-02 01:21:36 +08:00
Dylan MacKenzie b48def819e Regression test for case in #77361 2020-10-01 10:11:58 -07:00
Dylan MacKenzie 50e0c0d97b Give better const-checking error for async blocks 2020-10-01 10:11:58 -07:00
Mark Rousskov 9a3b9b44de Update rls
* https://github.com/rust-lang/rls/pull/1700
2020-10-01 13:07:41 -04:00
Joshua Nelson ca987789ea Update stdarch submodule
The primary purpose is to get the fixes from
https://github.com/rust-lang/stdarch/pull/920
and https://github.com/rust-lang/stdarch/pull/922.

The other changes included are
https://github.com/rust-lang/stdarch/pull/917 and
https://github.com/rust-lang/stdarch/pull/919.
2020-10-01 13:06:22 -04:00
Ivan Tham 676e4f193c
Add example for iter chain struct 2020-10-02 00:45:19 +08:00
Carol (Nichols || Goulding) a8fe654448
Write MAJOR.MINOR manifest for stable channel only 2020-10-01 12:06:45 -04:00
bors 2ad6187ce5 Auto merge of #76969 - withoutboats:rawfd-refexive-traits, r=dtolnay
Make RawFd implement the RawFd traits

This PR makes `RawFd` implement `AsRawFd`, `IntoRawFd` and `FromRawFd`, so it can be passed to interfaces that use one of those traits as a bound.
2020-10-01 15:39:33 +00:00
Mara Bos 2140d80a9d
Add note about possible future improvement
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-10-01 17:32:23 +02:00
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