Commit graph

128812 commits

Author SHA1 Message Date
Mara Bos
ec69a858e4 No longer put wasm condvars in a box.
These condvars are just an AtomicUsize, so can be moved without
problems.
2020-10-02 09:47:08 +02:00
Mara Bos
7f56a35411 No longer put condvars on the 'unsupported' platform in a box.
These condvars are unsupported and implemented as a ZST, so can be moved
without problems.
2020-10-02 09:47:08 +02:00
Mara Bos
5769a46788 No longer put cloudabi condvars in a box.
Cloudabi condvars may be moved safely.
2020-10-02 09:47:08 +02:00
Mara Bos
b181f5a923 Make it possible to have unboxed condvars on specific platforms.
This commit keeps all condvars boxed on all platforms, but makes it
trivial to remove the box on some platforms later.
2020-10-02 09:47:08 +02:00
Mara Bos
dc81cbdcb1 No longer put windows mutexes in a box.
Windows SRW locks are movable (while not borrowed) according to their
documentation.
2020-10-02 09:47:08 +02:00
Mara Bos
4f1353e54f No longer put wasm mutexes in a box.
These mutexes are just an AtomicUsize, so can be moved without
problems.
2020-10-02 09:47:08 +02:00
Mara Bos
2f0386771d No longer put mutexes on the 'unsupported' platform in a box.
These mutexes are just a bool (in a cell), so can be moved without
problems.
2020-10-02 09:47:08 +02:00
Mara Bos
def5188ca8 No longer put cloudabi mutexes in a box.
Cloudabi mutexes may be moved safely.
2020-10-02 09:47:08 +02:00
Mara Bos
58deb7001d Make it possible to have unboxed mutexes on specific platforms.
This commit keeps all mutexes boxed on all platforms, but makes it
trivial to remove the box on some platforms later.
2020-10-02 09:47:08 +02:00
Mara Bos
a8c2d4fc3d Move boxing and mutex checking logic of condvar into sys_common. 2020-10-02 09:47:08 +02:00
Esteban Küber
7d5a6203ec Fix span for incorrect pattern field and add label 2020-10-02 00:44:16 -07:00
Harald Hoyer
cadd12b5f0 Implement Make handle_alloc_error default to panic (for no_std + liballoc)
Related: https://github.com/rust-lang/rust/issues/66741

Guarded with `#![feature(default_alloc_error_handler)]` a default
`alloc_error_handler` is called, if a custom allocator is used and no
other custom `#[alloc_error_handler]` is defined.

The panic message does not contain the size anymore, because it would
pull in the fmt machinery, which would blow up the code size
significantly.
2020-10-02 09:00:29 +02:00
Ivan Tham
ddd19866a7
Clean up on example doc fixes for ptr::copy
Follow up of #77385
2020-10-02 14:44:01 +08:00
Andrew Dona-Couch
cd506eaea3 Fix AVR stack corruption bug
Updates the Rust LLVM fork to pull in a fix for a stack corruption
bug in AVR platform interrupt code lowering.

Fixes #75504
2020-10-02 04:07:00 +00:00
varkor
1db05e032d Add various min_const_generics regression tests 2020-10-02 02:22:01 +01:00
bors
f283d3f02c Auto merge of #77436 - JohnTitor:rollup-65dh7rp, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #76851 (Fix 'FIXME' about using NonZeroU32 instead of u32.)
 - #76979 (Improve std::sys::windows::compat)
 - #77111 (Stabilize slice_ptr_range.)
 - #77147 (Split sys_common::Mutex in StaticMutex and MovableMutex.)
 - #77312 (Remove outdated line from `publish_toolstate` hook)
 - #77362 (Fix is_absolute on WASI)
 - #77375 (rustc_metadata: Do not forget to encode inherent impls for foreign types)
 - #77385 (Improve the example for ptr::copy)
 - #77389 (Fix some clippy lints)
 - #77399 (BTreeMap: use Unique::from to avoid a cast where type information exists)
 - #77429 (Link `new` method in `DefautHasher`s doc)

Failed merges:

r? `@ghost`
2020-10-02 00:48:41 +00:00
varkor
0801263279 Fix missing diagnostic span for impl Trait with const generics 2020-10-02 01:39:04 +01:00
Wesley Wiser
f9d7720be7 Disable the SimplifyArmIdentity mir-opt
The optimization still has some bugs that need to be worked out
such as #77359.

We can try re-enabling this again after the known issues are resolved.
2020-10-01 20:29:53 -04:00
Yuki Okushi
5a7218009e
Rollup merge of #77429 - WaffleLapkin:doc_link_default_hasher_new, r=jyn514
Link `new` method in `DefautHasher`s doc

FIXME referenced #56922 which was resolved

r? @jyn514
2020-10-02 08:25:27 +09:00
Yuki Okushi
c820a522ca
Rollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
BTreeMap: use Unique::from to avoid a cast where type information exists

r? @Mark-Simulacrum
2020-10-02 08:25:25 +09:00
Yuki Okushi
fbb3dd4780
Rollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum
Fix some clippy lints

Found while working on https://github.com/rust-lang/rust/pull/77351;
these are just the ones that could be fixed automatically.
2020-10-02 08:25:24 +09:00
Yuki Okushi
2e749ab5a4
Rollup merge of #77385 - scottmcm:fix-77220, r=jyn514
Improve the example for ptr::copy

Fixes #77220
2020-10-02 08:25:22 +09:00
Yuki Okushi
b97334f65e
Rollup merge of #77375 - petrochenkov:inherext, r=oli-obk
rustc_metadata: Do not forget to encode inherent impls for foreign types

So I tried to move FFI interface for LLVM from `rustc_codegen_llvm` to `rustc_llvm` and immediately encountered this fascinating issue.

Fixes https://github.com/rust-lang/rust/issues/46665.
2020-10-02 08:25:20 +09:00
Yuki Okushi
55d0959328
Rollup merge of #77362 - RReverser:patch-1, r=dtolnay
Fix is_absolute on WASI

WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes.

Without this change, `is_absolute` for any paths, including `/some/path`, was returning `false`on a WASI target, which is obviously not true and undesirable.
2020-10-02 08:25:19 +09:00
Yuki Okushi
bf15fcd927
Rollup merge of #77312 - LeSeulArtichaut:toolstate-msg, r=Mark-Simulacrum
Remove outdated line from `publish_toolstate` hook

We no longer add `I-nominated` to toolstate failure issues since T-compiler changed its meeting preparation workflow.
2020-10-02 08:25:17 +09:00
Yuki Okushi
1c4a5f8d1e
Rollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dtolnay
Split sys_common::Mutex in StaticMutex and MovableMutex.

The (unsafe) `Mutex` from `sys_common` had a rather complicated interface. You were supposed to call `init()` manually, unless you could guarantee it was neither moved nor used reentrantly.

Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if `destroy()` should only be called when `init()` was called.

This allowed for a number of interesting (confusing?) different ways to use this `Mutex`, all captured in a single type.

In practice, this type was only ever used in two ways:

1. As a static variable. In this case, neither `init()` nor `destroy()` are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the `LockGuard`, never with `raw_lock`.

2. As a `Box`ed variable. In this case, both `init()` and `destroy()` are called, it will be moved and possibly used reentrantly.

No other combinations are used anywhere in `std`.

This change simplifies things by splitting this `Mutex` type into two types matching the two use cases: `StaticMutex` and `MovableMutex`.

The interface of both new types is now both safer and simpler. The first one does not call nor expose `init`/`destroy`, and the second one calls those automatically in its `new()` and `Drop` functions. Also, the locking functions of `MovableMutex` are no longer unsafe.

---

This will also make it easier to conditionally box mutexes later, by moving that decision into sys/sys_common. Some of the mutex implementations (at least those of Wasm and 'sys/unsupported') are safe to move, so wouldn't need a box. ~~(But that's blocked on  #76932 for now.)~~ (See #77380.)
2020-10-02 08:25:15 +09:00
Yuki Okushi
9eaf536c32
Rollup merge of #77111 - fusion-engineering-forks:stabilize-slice-ptr-range, r=dtolnay
Stabilize slice_ptr_range.

This has been unstable for almost a year now. Time to stabilize?

Closes #65807.

@rustbot modify labels: +T-libs +A-raw-pointers +A-slice +needs-fcp
2020-10-02 08:25:13 +09:00
Yuki Okushi
00b3450bbc
Rollup merge of #76979 - fusion-engineering-forks:windows-fallback-check, r=dtolnay
Improve std::sys::windows::compat

Improves the compat_fn macro in sys::windows, which is used for conditionally loading APIs that might not be available.

- The module (dll) name can now be any string, not just an ident. (Not all Windows api modules are valid Rust identifiers. E.g. `WaitOnAddress` comes from `API-MS-Win-Core-Synch-l1-2-0.dll`.)
- Adds `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.

---

The second point (`is_available()`) simplifies code that needs to pick an implementation depening on what is available, like `sys/windows/mutex.rs`. Before this change, it'd do its own lookup and keep its own `AtomicUsize` to track the result. Now it can just use `c::AcquireSRWLockExclusive::is_available()` directly.

This will also be useful when park/unpark/CondVar/etc. get improved implementations (e.g. from parking_lot or something else), as the best APIs for those are not available before Windows 8.
2020-10-02 08:25:11 +09:00
Yuki Okushi
1fa5f8f05b
Rollup merge of #76851 - fusion-engineering-forks:fixme-nonzero, r=petrochenkov
Fix 'FIXME' about using NonZeroU32 instead of u32.

It was blocked by #58732 (const fn NonZeroU32::new), which is fixed now.
2020-10-02 08:25:10 +09:00
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
Jonas Schievink
b01694e0a2 Returns values up to 2*usize by value 2020-10-02 00:23:25 +02:00
Vadim Petrochenkov
b20bce8ce5 Revert "resolve: Avoid "self-confirming" import resolutions in one more case" 2020-10-02 00:58:37 +03: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
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