13184 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
0f92eb8a4a
Rollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichton
Remove needless lifetimes (std)

Split from #62039
2019-07-05 13:52:58 +02:00
Mark Rousskov
007d87f171 Permit use of mem::uninitialized via allow(deprecated) 2019-07-04 21:01:35 -04:00
Jeremy Stucki
fc67e5774d
Add missing lifetime specifier
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-04 10:42:24 +02:00
Mazdak Farrokhzad
88c007cd04
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
2019-07-04 01:38:46 +02:00
Mark Rousskov
a0fcf5e6aa
Rollup merge of #62304 - SimonSapin:safe, r=eddyb
HashMap is UnwindSafe

Fixes https://github.com/rust-lang/rust/issues/62301, a regression in 1.36.0-pre which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
2019-07-03 09:59:28 -04:00
Mark Rousskov
05704e80bc
Rollup merge of #62183 - alexcrichton:fix-tests, r=nikomatsakis
std: Move a process test out of libstd

This commit moves a test out of libstd which is causing deadlocks on
musl on CI. Looks like the recent update in musl versions brings in some
internal updates to musl which makes `setgid` and `setuid` invalid to
call after a `fork` in a multithreaded program. The issue seen here is
that the child thread was attempting to grab a lock held by a
nonexistent thread, meaning that the child process simply deadlocked
causing the whole test to deadlock.

This commit moves the test to its own file with no threads which should
work.
2019-07-03 09:59:16 -04:00
Simon Sapin
7454b29efc HashMap is UnwindSafe
Fixes https://github.com/rust-lang/rust/issues/62301, a regression in 1.36.0 which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
2019-07-02 16:01:06 +02:00
Chris Gregory
b0c199a969 Enable mem_take feature in relevant crates 2019-07-01 20:21:53 -07:00
Chris Gregory
636f5e6d11 Convert more usages over 2019-07-01 20:21:12 -07:00
Jeremy Stucki
47ea8ae022
Remove needless lifetimes 2019-07-01 12:15:27 +02:00
varkor
b613ef1436 Extend the #[must_use] lint to boxed types 2019-06-30 18:19:28 +01:00
Mazdak Farrokhzad
75edfe204b
Rollup merge of #62163 - cuviper:unix-uninit, r=RalfJung
Avoid mem::uninitialized() in std::sys::unix

For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.

r? @RalfJung
2019-06-29 11:18:13 +02:00
Mazdak Farrokhzad
36b26e9bac
Rollup merge of #62102 - RalfJung:read, r=Centril
call out explicitly that general read needs to be called with an initialized buffer
2019-06-27 23:01:04 +02:00
Mazdak Farrokhzad
2f6cf36b32
Rollup merge of #62043 - Centril:remove-fnbox, r=cramertj
Remove `FnBox`

Remove `FnBox` since we now have `Box<dyn FnOnce>`.

Closes https://github.com/rust-lang/rust/issues/28796.

r? @cramertj
2019-06-27 23:01:00 +02:00
Alex Crichton
2a375827ab std: Move a process test out of libstd
This commit moves a test out of libstd which is causing deadlocks on
musl on CI. Looks like the recent update in musl versions brings in some
internal updates to musl which makes `setgid` and `setuid` invalid to
call after a `fork` in a multithreaded program. The issue seen here is
that the child thread was attempting to grab a lock held by a
nonexistent thread, meaning that the child process simply deadlocked
causing the whole test to deadlock.

This commit moves the test to its own file with no threads which should
work.
2019-06-27 07:54:53 -07:00
Josh Stone
b533aff927 Use pointer::write_bytes for android sigemptyset 2019-06-26 16:27:54 -07:00
Josh Stone
3ba1f39fe7 Avoid mem::uninitialized() in std::sys::unix
For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.
2019-06-26 15:03:15 -07:00
Ralf Jung
390f717a0a tweak wording 2019-06-25 22:59:00 +02:00
Ralf Jung
1c12b1be33 call out explicitly that general read needs to be called with an initialized buffer 2019-06-24 22:58:53 +02:00
Mazdak Farrokhzad
a99a7b7f35 Remove FnBox. 2019-06-22 06:59:27 +02:00
Felix Rabe
eceeedc7b0
Typo 2019-06-22 00:44:31 +02:00
Mazdak Farrokhzad
d3898a6731
Rollup merge of #61900 - s3bk:master, r=sfackler
implement Error::source for Box<T: Error>

fixes https://github.com/rust-lang/rust/issues/61899
2019-06-20 22:14:24 +02:00
bors
3c805ce183 Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichton
macos tlv workaround

fixes: #60141

Includes:
* remove dead code: `requires_move_before_drop`. This hasn't been needed for a while now (oops I should have removed it in #57655)
* redox had a copy of `fast::Key` (not sure why?). That has been removed.
* Perform a `read_volatile` on OSX to reduce `tlv_get_addr` calls per `__getit` from (4-2 depending on context) to 1.

`tlv_get_addr` is relatively expensive (~1.5ns on my machine).

Previously, in contexts where `__getit` was inlined, 4 calls to `tlv_get_addr` were performed per lookup. For some reason when `__getit` is not inlined this is reduced to 2x - and performance improves to match.

After this PR, I have only ever seen 1x call to `tlv_get_addr` per `__getit`, and macos now benefits from situations where `__getit` is inlined.

I'm not sure if the `read_volatile(&&__KEY)` trick is working around an LLVM bug, or a rustc bug, or neither.

r? @alexcrichton
2019-06-20 02:36:49 +00:00
bors
605ea9d05c Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddyb
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation

We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively):
- redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag`
- add `Clone` for `VaListImpl`
- add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList`
- add deref coercion from `VaList` to `VaListImpl`
- add support for the `asmjs` target

All these changes were needed for use cases like:
```Rust
let mut ap2 = va_copy(ap);
vprintf(fmt, ap2);
va_end(&mut ap2);
```
2019-06-18 21:50:46 +00:00
Andrei Homescu
b9ea653aee Expose VaListImpl as the Rust equivalent of __va_list_tag and implement Clone for it. 2019-06-17 16:04:49 -07:00
Lzu Tao
7d69d4ced2 Make use of ptr::null(_mut) instead of casting zero 2019-06-17 10:52:46 +00:00
s3bk
8951cb5c40 implement Error::source for Box<T: Error>
fixes https://github.com/rust-lang/rust/issues/61899
2019-06-17 11:24:09 +03:00
Ralf Jung
e5f840ecb5 make sure we use cfg-if as a std dependency 2019-06-14 11:01:28 +02:00
Mazdak Farrokhzad
e45c83ca23
Rollup merge of #61757 - sfackler:deprecate-once-init, r=alexcrichton
Deprecate ONCE_INIT in future 1.38 release

Once::new() has been a stable const fn for a while now.

Closes #61746
2019-06-13 14:51:57 +02:00
Mazdak Farrokhzad
ca06f8896b
Rollup merge of #61720 - alexcrichton:libstd-cfg-if-dep, r=sfackler
std: Remove internal definitions of `cfg_if!` macro

This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
2019-06-13 14:51:56 +02:00
Steven Fackler
72e99f57c5 Deprecate ONCE_INIT
Once::new() has been a stable const fn for a while now.

Closes #61746
2019-06-12 21:32:51 -07:00
Vadim Petrochenkov
eb09daa762 Hygienize macros in the standard library 2019-06-12 20:27:29 +03:00
Mazdak Farrokhzad
79ac254703
Rollup merge of #61652 - JohnTitor:docs-improve-array, r=Centril
Mention slice patterns in array

Fixes #61650

r? @scottmcm
2019-06-11 17:14:01 +02:00
Alex Crichton
8eb7f36a3b std: Remove internal definitions of cfg_if! macro
This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
2019-06-10 10:58:44 -07:00
Yuki Okushi
3cfceb94cf Add an example 2019-06-10 13:30:45 +09:00
Yuki Okushi
1a32a68f38 Mention slice patterns 2019-06-08 16:13:15 +09:00
Mazdak Farrokhzad
b3bdc24a89
Rollup merge of #61647 - JohnTitor:use-stable-func, r=Centril
Use stable wrappers in f32/f64::signum

Fixes #61638

r? @Centril
2019-06-08 03:34:02 +02:00
Mazdak Farrokhzad
2a9bcbf9a9
Rollup merge of #61223 - czipperz:tuple-ord-document-ordering, r=oli-obk
Document tuple's Ord behavior as sequential

Partially closing #50727
2019-06-08 03:33:54 +02:00
Yuki Okushi
43ab14e2f4 Use stable wrappers 2019-06-08 09:36:46 +09:00
Mazdak Farrokhzad
06a1df4954
Rollup merge of #61603 - Goirad:increase-sgx-heapsize, r=alexcrichton
Increases heap size available during testing for SGX

PR [61540](https://github.com/rust-lang/rust/pull/61540) causes at least one test to fail when run for the SGX platform due to lack of memory. This PR increases the heapsize available during tests, which is a good thing regardless of the status of that PR.
2019-06-07 16:48:08 +02:00
Dario Gonzalez
9a49841961 increase max heapsize available during sgx tests 2019-06-06 14:13:16 -07:00
varkor
a31848350b Update compiler_builtins 2019-06-06 21:27:07 +01:00
bors
740668dbd9 Auto merge of #57428 - alexreg:associated_type_bounds, r=nikomatsakis,Centril
Implementation of RFC 2289 (associated_type_bounds)

This PR implements the [`asociated_type_bounds` feature](https://github.com/rust-lang/rfcs/blob/master/text/2289-associated-type-bounds.md).

Associated type bounds are implemented in:
   - function/method arguments and return types
   - structs, enums, unions
   - associated items in traits
   - type aliases
   - type parameter defaults
   - trait objects
   - let bindings

CC @nikomatsakis @centril
2019-06-06 03:56:22 +00:00
Alexander Regueiro
35585c499f Aggregation of drive-by cosmetic changes. 2019-06-05 21:09:26 +01:00
Mazdak Farrokhzad
76f9f6b2ab
Rollup merge of #61534 - ReinierMaas:patch-1, r=Centril
Edit docs of ExitStatus

The documentation of [`ExitStatus`] are extended to be at the same depth as [`Output`].
2019-06-05 17:43:30 +02:00
Mazdak Farrokhzad
713ebb462c
Rollup merge of #61503 - jethrogb:jb/fix-sgx-test, r=alexcrichton
Fix cfg(test) build for x86_64-fortanix-unknown-sgx
2019-06-05 17:43:28 +02:00
bors
817d2feb13 Auto merge of #61502 - alexcrichton:update-backtrace, r=estebank
std: Update dependency on `backtrace`

Discovered in #61416 an accidental regression in libstd's backtrace
behavior is that it previously attempted to consult libbacktrace and
would then fall back to `dladdr` if libbacktrace didn't report anything.
The `backtrace` crate, however, did not do this, so that's now been
fixed!

Changes: https://github.com/rust-lang/backtrace-rs/compare/0.3.25...0.3.29

Closes #61416
2019-06-05 08:20:20 +00:00
Reinier Maas
dd12f39b35
Tidy: trailing whitespace
Removed trailing whitespace from documentation of ExitStatus.
2019-06-05 09:58:39 +02:00
Reinier Maas
674f24e132
Edit docs of ExitStatus
The documentation of [`ExitStatus`] are extended to be at the same depth as [`Output`].
2019-06-05 08:41:37 +02:00
Alex Crichton
fa1b6add09 std: Update dependency on backtrace
Discovered in #61416 an accidental regression in libstd's backtrace
behavior is that it previously attempted to consult libbacktrace and
would then fall back to `dladdr` if libbacktrace didn't report anything.
The `backtrace` crate, however, did not do this, so that's now been
fixed!

Changes: https://github.com/rust-lang/backtrace-rs/compare/0.3.25...0.3.27

Closes #61416
2019-06-04 18:45:39 -07:00