Commit Graph

128640 Commits

Author SHA1 Message Date
bors
66936de059 Auto merge of #77412 - Mark-Simulacrum:rls-fix, r=Xanewok
Update rls

Includes https://github.com/rust-lang/rls/pull/1700, just fixing compilation and test failures.

Fixes #77311.
2020-10-01 22:37:05 +00:00
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
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
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
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
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
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
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
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