Commit Graph

3789 Commits

Author SHA1 Message Date
Matthias Krüger ea076a4f9f Rollup merge of #101798 - y86-dev:const_waker, r=lcnr
Make `from_waker`, `waker` and `from_raw` unstably `const`

Make
- `Context::from_waker`
- `Context::waker`
- `Waker::from_raw`

`const`.

Also added a small test.
2022-09-19 17:55:19 +02:00
Matthias Krüger 92d8bf918c Rollup merge of #101861 - wesleywiser:update_stdarch, r=Amanieu
Update stdarch

This pulls in the following changes:

- [Use simd_bitmask intrinsic in a couple of places](https://github.com/rust-lang/stdarch/commit/9f0928782b051edb6add78e9310472abface1e5c)
- [Remove simd_shuffle<n> usage in favor of simd_shuffle](https://github.com/rust-lang/stdarch/commit/3fd17e46079dbb5b99888dbcfdd232f2c023dff5)
- [Remove late specifiers in __cpuid_count](https://github.com/rust-lang/stdarch/commit/f1db941633e6e12bf62093cf0458bcbd7031c663)
  - Helps with #101346
- [Use mov and xchg instead of movl(q) and xchgl(q)](https://github.com/rust-lang/stdarch/commit/3049a31937e4f7353e1dea2f6dc558b02451bb13)
- [Bump cfg-if dependency to 1.0](https://github.com/rust-lang/stdarch/commit/f305cc83e7036f250a2a437021552526d1398cb4)
- [Fix documentation of __m256bh and __m512bh structs](https://github.com/rust-lang/stdarch/commit/699c093a42283c07e9763b4c19439a900ae2d321)

r? ``@Amanieu``
2022-09-17 19:27:07 +02:00
Matthias Krüger 00d88bdb2c Rollup merge of #101672 - idigdoug:array_try_into, r=Mark-Simulacrum
array docs - advertise how to get array from slice

On my first Rust project, I spent more time than I care to admit figuring out how to efficiently get an array from a slice. Update the array documentation to explain this a bit more clearly.

(As a side note, it's a bit unfortunate that get-array-from-slice is only available via trait since that means it can't be used from const functions yet.)
2022-09-17 19:27:05 +02:00
est31 173eb6f407 Only enable the let_else feature on bootstrap
On later stages, the feature is already stable.

Result of running:

rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-15 21:06:45 +02:00
Wesley Wiser 9286c3c3f5 Update stdarch
stdarch updated their version of `cfg-if` so we need to update the one
used by libstd as well.
2022-09-15 13:05:28 -04:00
Matthias Krüger 93ae223951 Rollup merge of #101559 - andrewpollack:add-backtrace-off-fuchsia, r=tmandry
Adding "backtrace off" option for fuchsia targets

Used for improving compiler test suite results on Fuchsia targets
2022-09-15 08:00:12 +02:00
Andrew Pollack 88baf8f6f5 Adding backtrace off option for fuchsia targets 2022-09-14 23:54:40 +00:00
y86-dev 9a78faba71 Made from_waker, waker, from_raw const 2022-09-14 14:53:16 +02:00
Markus Reiter 14230a7f8e Simplify clippy fix. 2022-09-12 19:46:51 +02:00
Markus Reiter d01498a902 Add rustc_diagnostic_item for IP addresses. 2022-09-12 19:04:17 +02:00
Markus Reiter f7e8ba28a4 Flatten net module again. 2022-09-12 19:04:17 +02:00
Markus Reiter a1e4a339ed Move net::parser into net::addr module. 2022-09-12 19:04:17 +02:00
Markus Reiter 65003fd4e3 Add tests for SockAddr Display. 2022-09-12 19:04:16 +02:00
Markus Reiter 96b44f6f65 Use DisplayBuffer for socket addresses. 2022-09-12 19:04:16 +02:00
Dylan DPC 93177758fc Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726
Remove manual <[u8]>::escape_ascii

`@rustbot` label: +C-cleanup
2022-09-12 15:21:30 +05:30
bors 98e1f041b6 Auto merge of #101442 - joboet:null_check_tcs, r=thomcc
Check if TCS is a null pointer on SGX

The `EENTER` instruction only checks if the TCS is aligned, not if it zero. Saying the address returned is a `NonNull<u8>` (for which `Tcs` is a type alias) is unsound. As well-behaved runners will not put the TCS at address zero, so the definition of `Tcs` is correct. However, `std` should check the address before casting it to a `NonNull`.

ping `@jethrogb` `@raoulstrackx`
`@rustbot` label I-unsound
2022-09-11 22:19:24 +00:00
joboet 2fa58080cb std: check if TCS is a null pointer 2022-09-11 12:15:32 +02:00
bors 56b625be68 Auto merge of #101482 - joboet:netbsd_parker, r=sanxiyn
Optimize thread parking on NetBSD

As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called.

r? `@m-ou-se`
2022-09-11 04:07:17 +00:00
Doug Cook (WINDOWS) 705a7667c5 array docs - advertise how to get array from slice
On my first Rust project, I spent more time than I care to admit
figuring out how to efficiently get an array from a slice. Update the
array documentation to explain this a bit more clearly.

(As a side note, it's a bit unfortunate that get-array-from-slice is
only available via trait since that means it can't be used from const
functions yet.)
2022-09-10 19:37:07 -07:00
bors abd4d2ef0d Auto merge of #101643 - ChrisDenton:alloc-link-kernel32, r=thomcc
Explicitly link kernel32.lib from alloc
2022-09-11 01:44:09 +00:00
joboet 81b11ed698 std: optimize thread parking on NetBSD 2022-09-10 20:03:15 +02:00
Dylan DPC 33d54c4f73 Rollup merge of #101606 - akhi3030:patch-1, r=Dylan-DPC
doc: fix minor typo
2022-09-10 18:56:07 +05:30
Chris Denton 931e851144 Explicitly link kernel32.lib from alloc 2022-09-10 11:57:36 +01:00
bors 395e56f398 Auto merge of #101617 - Dylan-DPC:rollup-iiy4ipc, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #101366 (Restore old behaviour on broken UNC paths)
 - #101492 (Suggest adding array lengths to references to arrays if possible)
 - #101529 (Fix the example code and doctest for Formatter::sign_plus)
 - #101573 (update `ParamKindOrd`)
 - #101612 (Fix code generation of `Rvalue::Repeat` with 128 bit values)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-09 23:06:40 +00:00
Dylan DPC d9609c7c26 Rollup merge of #101366 - ChrisDenton:unc-forward-slash, r=m-ou-se
Restore old behaviour on broken UNC paths

This fixes #101358 by restoring the behaviour from previous stable Rust versions. I'm not convinced this is ultimately right but I think it's less wrong and maybe this should be backported to beta?

r? libs
2022-09-09 22:02:16 +05:30
joboet 262193e044 std: use futex-based locks and thread parker on Hermit 2022-09-09 11:56:50 +02:00
Akhilesh Singhania 1933b74dbd doc: fix minor typo 2022-09-09 11:30:40 +02:00
Michael Goulet 2c4dc4f494 Rollup merge of #101423 - mkroening:hermit-warnings, r=sanxiyn
Fix hermit warnings

This fixes two `unused_imprt` and one `dead_code` warning for hermit.
2022-09-08 14:41:08 -07:00
Dylan DPC 7064344ba4 Rollup merge of #101422 - mkroening:hermit-file-time, r=joshtriplett
Hermit: Add File::set_time stub

This is not supported on hermit yet. This change is required for compiling std.
2022-09-08 11:55:07 +05:30
bors c2804e6ec2 Auto merge of #101544 - matthiaskrgr:rollup-4urx917, r=matthiaskrgr
Rollup of 14 pull requests

Successful merges:

 - #101343 (Add -api-level to pm command)
 - #101416 (stdio: Document no support for writing to non-blocking stdio/stderr)
 - #101435 (Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH`)
 - #101493 (Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow)
 - #101502 (Do not suggest a semicolon for a macro without `!`)
 - #101503 (Add debug calls)
 - #101506 (rustdoc: remove unused CSS `#main-content > .since`)
 - #101507 (rustdoc: remove unused CSS `#main-content > table td`)
 - #101521 (Rustdoc-Json: More accurate struct type.)
 - #101525 (Fix typo in pass_manager.rs)
 - #101534 (rustdoc: remove unused mobile CSS `.rustdoc { flex-direction }`)
 - #101535 (Fix error printing mistake in tidy)
 - #101536 (Add documentation for Attr::is_doc_comment)
 - #101538 (rustdoc: remove unused CSS `.content .methods > div`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-07 21:17:30 +00:00
bors 9682b5d3a3 Auto merge of #101476 - ChrisDenton:BCryptRandom-fix, r=thomcc
Open a BCrypt algorithm handle

Fixes #101474, supplants #101456.

Replaces use of a pseduo handle with manually opening a algorithm handle.

Most interesting thing here is the atomics.

r? `@thomcc`
2022-09-07 18:54:03 +00:00
Usama Arif dfbc1f712d stdio: Document no support for writing to non-blocking stdio/stderr
Printing to stdio/stderr that have been opened with non-blocking
(O_NONBLOCK in linux) can result in an error, which is not handled
by std::io module causing a panic.

Signed-off-by: Usama Arif <usama.arif@bytedance.com>
2022-09-07 14:22:57 +01:00
Chris Denton 832c7af0ea Don't break windows/rand for miri 2022-09-07 14:00:15 +01:00
Chris Denton b2e4f9dcb3 Open a BCrypt algorithm handle 2022-09-06 19:29:58 +01:00
Chris Denton 774e71228c Fix compile errors for uwp-windows-msvc targets 2022-09-06 14:57:42 +01:00
Yuki Okushi c6f6b1821d Rollup merge of #101426 - beetrees:dup-no-stdio, r=thomcc
Don't duplicate file descriptors into stdio fds

Ensures that file descriptors are never duplicated into the stdio fds even if a stdio fd has been closed.
2022-09-06 08:36:09 +09:00
Yuki Okushi ff124c6ae8 Rollup merge of #101404 - joboet:always_cleanup_stdout, r=joshtriplett
Fix cleanup for uninitialized stdout

Fixes #101375 by disabling buffering even if the buffer was not initialized yet.
2022-09-06 08:36:05 +09:00
Dylan DPC e4534fe6fe Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obk
more clippy::perf fixes
2022-09-05 14:15:52 +05:30
joboet 774cadfbfa std: fix cleanup for uninitialized stdout (#101375) 2022-09-05 09:08:07 +02:00
bors e7cdd4c090 Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrum
Make `ReentrantMutex` movable and `const`

As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.
2022-09-04 22:53:58 +00:00
Martin Kröning ce305f8f8e Hermit: Remove unused socklen_t (dead_code) 2022-09-05 00:23:38 +02:00
Martin Kröning 11af142c93 Hermit: Fix unused_imports 2022-09-05 00:23:38 +02:00
Martin Kröning 3b985b4dd6 Hermit: Add File::set_time stub
This is not supported on hermit yet. This change is required for compiling std.
2022-09-05 00:17:46 +02:00
Matthias Krüger 723f0c477b Rollup merge of #101394 - CAD97:patch-3, r=Mark-Simulacrum
Forbid mixing `System` with direct sytem allocator calls

e.g. [on windows](https://github.com/rust-lang/rust/blob/dec689432fac6720b2f18101ac28a21add98b1b8/library/std/src/sys/windows/alloc.rs#L129-L178), trying to mix `System::alloc` and `HeapFree` will not work because of the extra work done to serve higher alignments.
2022-09-04 18:55:46 +02:00
beetrees 0e0756cf0d Don't duplicate file descriptors into stdio fds 2022-09-04 10:22:36 +01:00
Christopher Durham 69721defc2 Forbid mixing System with sytem allocator calls 2022-09-03 16:47:12 -05:00
Matthias Krüger 6f4726541e more clippy::perf fixes 2022-09-03 22:57:22 +02:00
Bart Massey 3afbc115f7 updated description of File struct in std::fs 2022-09-03 11:09:06 -07:00
joboet 8c37fdf2d7 std: make ReentrantMutex movable and const; simplify Stdout initialization 2022-09-03 14:05:28 +02:00
Chris Denton 0fe54d4650 Restore old behaviour on broken UNC paths 2022-09-03 07:56:38 +01:00