Commit Graph

8209 Commits

Author SHA1 Message Date
Josh Triplett
377aa764aa Attempt to fix up SGX for random API updates 2025-07-13 02:54:27 -07:00
León Orell Valerian Liehr
5d5645972f Rollup merge of #143776 - no1wudi:fix, r=tgross35
std: move NuttX to use arc4random for random number generation

arc4random support in libc merged in https://github.com/rust-lang/libc/pull/4464, so:

* Move `target_os = "nuttx"` from unix_legacy to arc4random section
* This aligns NuttX with other POSIX-compliant systems that support arc4random
* Improves random number generation quality on NuttX by using the system's built-in arc4random implementation instead of legacy fallback methods

NuttX supports arc4random_buf which provides better entropy and security compared to the legacy random number generation methods.
2025-07-13 07:21:19 +02:00
Orson Peters
6f4d0bdde8 Tidy 2025-07-13 01:20:29 +02:00
Orson Peters
69b9bae57d Guarantee 8 bytes of alignment in Thread::into_raw 2025-07-13 00:58:46 +02:00
bors
915e535244 Auto merge of #143810 - matthiaskrgr:rollup-iw7a23z, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143403 (Port several trait/coherence-related attributes the new attribute system)
 - rust-lang/rust#143633 (fix: correct assertion to check for 'noinline' attribute presence before removal)
 - rust-lang/rust#143647 (Clarify and expand documentation for std::sys_common dependency structure)
 - rust-lang/rust#143716 (compiler: doc/comment some codegen-for-functions interfaces)
 - rust-lang/rust#143747 (Add target maintainer information for aarch64-unknown-linux-musl)
 - rust-lang/rust#143759 (Fix typos in function names in the `target_feature` test)
 - rust-lang/rust#143767 (Bump `src/tools/x` to Edition 2024 and some cleanups)
 - rust-lang/rust#143769 (Remove support for SwitchInt edge effects in backward dataflow)
 - rust-lang/rust#143770 (build-helper: clippy fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-12 10:46:43 +00:00
Matthias Krüger
140fc184f2 Rollup merge of #143647 - ColtenOuO:master, r=ChrisDenton
Clarify and expand documentation for std::sys_common dependency structure

This PR makes a minor improvement to the module-level documentation of std::sys_common:

Replaces the lowercase “dag” with the more standard and explicit form “DAG (Directed Acyclic Graph)” for clarity.
2025-07-11 19:45:23 +02:00
Josh Triplett
5e203851f7 random: Provide a Distribution<T> trait
This will let people make calls like random(1..=6), and allows for
future expansion to non-uniform distributions, as well as
floating-point.

For now, this is only implemented for `RangeFull`, to get the interface
in place. Subsequent commits will implement it for other range types.
2025-07-11 10:21:34 -07:00
Huang Qi
074846289a std: move NuttX to use arc4random for random number generation
* Move `target_os = "nuttx"` from unix_legacy to arc4random section
* This aligns NuttX with other POSIX-compliant systems that support arc4random
* Improves random number generation quality on NuttX by using the system's
  built-in arc4random implementation instead of legacy fallback methods

NuttX supports arc4random_buf which provides better entropy and security
compared to the legacy random number generation methods.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-07-11 17:31:27 +08:00
Matthias Krüger
5cbf7cf9c4 Rollup merge of #143568 - Ayush1325:uefi-tcp4-timeout, r=tgross35
std: sys: net: uefi: tcp4: Add timeout support

- Implement timeout support for read, write and connect.
- A software implementation using Instant.
2025-07-11 07:35:19 +02:00
Matthias Krüger
2730bebbf8 Rollup merge of #142391 - LevitatingBusinessMan:setsid, r=workingjubilee
rust: library: Add `setsid` method to `CommandExt` trait

Add a setsid method to the CommandExt trait so that callers can create a process in a new session and process group whilst still using the POSIX spawn fast path.

Tracking issue: rust-lang/rust#105376

ACP: https://github.com/rust-lang/libs-team/issues/184

This PR was previously submitted by ``@HarveyHunt`` (whom I marked as Co-Author in the commit message) in rust-lang/rust#105377. However that PR went stale.

I applied the [suggestion](231d19fcbf (r1893457943)) to change the function signature to `fn setsid(&mut self, setsid: bool) -> &mut Command`.
2025-07-11 07:35:17 +02:00
Colten
3c11029ace docs: clarify “dag” in std::sys_common doc comment 2025-07-11 11:53:47 +08:00
Matthias Krüger
a17559bff5 Rollup merge of #143668 - biabbas:vxworks, r=Noratrieb
Fix VxWorks build errors

fixes rust-lang/rust#143442

r? ``@Noratrieb``
2025-07-10 15:19:33 +02:00
LevitatingBusinessMan (Rein Fernhout)
e0f76871ed rust: library: Add setsid method to CommandExt trait
Add a setsid method to the CommandExt trait so that callers can create
a process in a new session and process group whilst still using the
POSIX spawn fast path.

Co-Authored-By: Harvey Hunt <harveyhunt@fb.com>
2025-07-10 05:26:58 +02:00
Ayush Singh
d8273d3997 std: sys: net: uefi: tcp4: Add timeout support
- Implement timeout support for read, write and connect.
- A software implementation using Instant.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-07-09 22:38:12 +05:30
Oli Scherer
486ffda9dc Add opaque TypeId handles for CTFE 2025-07-09 16:37:11 +00:00
Benoît du Garreau
803b4d2622 core: Remove BorrowedCursor::init_ref method
This method was not really useful: at no point one would only need to
read the initialized part of the cursor without mutating it.
2025-07-09 18:11:26 +02:00
B I Mohammed Abbas
6637335845 Fix VxWorks build errors 2025-07-09 09:54:08 +05:30
Matthias Krüger
2554c424ef Rollup merge of #143340 - nabijaczleweli:awhile, r=mati865
awhile -> a while where appropriate
2025-07-07 19:55:32 +02:00
Chris Denton
2412f8921c UWP: link ntdll functions using raw-dylib 2025-07-07 15:39:31 +00:00
xizheyin
2765bd48f0 std: fix typo in std::path
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-07 15:20:22 +08:00
bors
ca98d4d4b3 Auto merge of #141829 - dvdsk:sleep_until_linux, r=cuviper,RalfJung
Specialize sleep_until implementation for unix (except mac)

related tracking issue: https://github.com/rust-lang/rust/issues/113752
Supersedes https://github.com/rust-lang/rust/pull/118480 for the reasons see: https://github.com/rust-lang/rust/issues/113752#issuecomment-2902594469

Replaces the generic catch all implementation with target_os specific ones for: linux/netbsd/freebsd/android/solaris/illumos etc. Other platforms like wasi, macos/ios/tvos/watchos and windows will follow in later separate PR's (once this is merged).
2025-07-06 23:00:51 +00:00
dvdsk
61cf174dce sleep_until: add clock_nanosleep support to Miri
The clock_nanosleep support is there to allow code using `sleep_until`
to run under Miri. Therefore the implementation is minimal.
- Only the clocks REALTIME and MONOTONIC are supported. The first is supported simply
because it was trivial to add not because it was needed for sleep_until.
- The only supported flag combinations are no flags or TIMER_ABSTIME only.
If an unsupported flag combination or clock is passed in this throws
unsupported.
2025-07-06 17:49:35 +02:00
dvdsk
f24ee2c9b1 sleep_until: use clock_nanosleep where possible
Using clock nanosleep leads to more accurate sleep times on platforms
where it is supported.

To enable using clock_nanosleep this makes `sleep_until` platform
specific. That unfortunatly requires identical placeholder
implementations for the other platforms (windows/mac/wasm etc).

we will land platform specific implementations for those later. See the
`sleep_until` tracking issue.

This requires an accessors for the Instant type. As that accessor is only
used on the platforms that have clock_nanosleep it is marked as allow_unused.

32bit time_t targets do not use clock_nanosleep atm, they instead rely
on the same placeholder as the other platforms. We could make them
use clock_nanosleep too in the future using `__clock_nanosleep_time64`.

__clock_nanosleep_time64 is documented at:
https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html
2025-07-06 17:36:49 +02:00
Matthias Krüger
19f8ba4733 Rollup merge of #143470 - Ayush1325:uefi-tcp4-recv, r=joshtriplett
std: sys: net: uefi: tcp4: Implement read

- A blocking implementation of tcp4 read.
- Basically a copy of [write](https://github.com/rust-lang/rust/pull/141532)
2025-07-06 10:03:22 +02:00
Ricardo Fernández Serrata
a3208108b0 fix(lib-std-fs): handle usize overflow in read & read_to_string 2025-07-05 22:10:10 +00:00
Jubilee
2f119daf4e Rollup merge of #143086 - SciMind2460:patch-2, r=workingjubilee
Update poison.rs to fix the typo (sys->sync)
2025-07-04 23:26:20 -07:00
Ayush Singh
1f01d9b3db std: sys: net: uefi: tcp4: Implement read
A blocking implementation of tcp4 read.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-07-05 11:10:38 +05:30
Matthias Krüger
edfaaeb397 Rollup merge of #141532 - Ayush1325:uefi-tcp4-send, r=tgross35
std: sys: net: uefi: tcp4: Implement write

A blocking implementation of tcp4 write.
2025-07-05 00:12:08 +02:00
Ayush Singh
f4ef1a769a std: sys: net: uefi: tcp4: Implement write
A blocking implementation of tcp4 write.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-07-04 21:53:16 +05:30
Matthias Krüger
2faf66d091 Rollup merge of #143387 - dpaoliello:shouldpanicfn, r=bjorn3
Make __rust_alloc_error_handler_should_panic a function

Fixes rust-lang/rust#143253

`__rust_alloc_error_handler_should_panic` is a static but was being exported as a function.

For most targets this doesn't matter, but Arm64EC Windows uses different decorations for exported variables vs functions, hence it fails to link when `-Z oom=abort` is enabled.

We've had issues in the past with statics like this (see rust-lang/rust#141061) but the tldr; is that Arm64EC needs symbols correctly exported as either a function or data, and data MUST and MUST ONLY be marked `dllimport` when the symbol is being imported from another binary, which is non-trivial to calculate for these compiler-generated statics.

So, instead, the easiest thing to do is to make `__rust_alloc_error_handler_should_panic` a function instead.

Since `__rust_alloc_error_handler_should_panic` isn't involved in any linking shenanigans, I've marked it as `AlwaysInline` with the hopes that the various backends will see that it is just returning a constant and perform the same optimizations as the previous implementation.

r? `@bjorn3`
2025-07-04 16:22:36 +02:00
Daniel Paoliello
2b22d0f0d2 Make __rust_alloc_error_handler_should_panic a function 2025-07-03 10:52:21 -07:00
Jana Dönszelmann
f6d37a25a9 Rollup merge of #134006 - klensy:typos, r=nnethercote
setup typos check in CI

This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying?

Also includes commits with actual typo fixes.

MCP: https://github.com/rust-lang/compiler-team/issues/817

typos check currently turned for:
* ./compiler
* ./library
* ./src/bootstrap
* ./src/librustdoc

After merging, PRs which enables checks for other crates (tools) can be implemented too.

Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr.

Check typos: `python x.py test tidy --extra-checks=spellcheck`
Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo)

Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03 13:29:35 +02:00
klensy
c76d032f01 setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
наб
a0111ec7a1 awhile -> a while where appropriate 2025-07-02 20:17:29 +02:00
Matthias Krüger
0d5af18c14 Rollup merge of #141847 - xizheyin:141837, r=jhpratt
Explain `TOCTOU` on the top of `std::fs`, and reference it in functions

Fixes rust-lang/rust#141837

r? ``````@workingjubilee``````
2025-07-02 19:28:03 +02:00
bors
f51c9870ba Auto merge of #142974 - cuviper:stage0-bump, r=Mark-Simulacrum
Update stage0 to 1.89.0-beta.1

- Update version placeholders
- Update stage0 to 1.89.0-beta.1
- Update `STAGE0_MISSING_TARGETS`
- Update `cfg(bootstrap)`

r? `@Mark-Simulacrum`

try-job: dist-i586-gnu-i586-i686-musl
2025-07-02 01:41:18 +00:00
Josh Stone
e851e3e16e Update cfg(bootstrap) 2025-07-01 10:55:49 -07:00
Josh Stone
9ce8930da6 Update version placeholders 2025-07-01 10:54:33 -07:00
Guillaume Gomez
827cd29a4c Rollup merge of #142760 - epage:lock, r=tgross35
docs(fs): Touch up grammar on lock api
2025-07-01 17:47:01 +02:00
Trevor Gross
978e11baa2 Upgrade the fortanix-sgx-abi dependency
0.6.1 removes the `compiler-builtins` dependency, part of RUST-142265.
The breaking change from 0.5 to 0.6 is for an update to the
`insecure_time` API [1].

I validated that `./x c library --target x86_64-fortanix-unknown-sgx`
completes successfully with this change.

Link: a34e9767f3 [1]
2025-07-01 03:33:10 -05:00
dianqk
a94f0a4af8 Rollup merge of #143090 - ChrisDenton:workaround1, r=tgross35
Workaround for memory unsafety in third party DLLs

Resolves rust-lang/rust#143078

Note that we can't make any guarantees if third parties intercept OS functions and don't implement them according to the documentation. However, I think it's practical to attempt mitigations when issues are encountered in the wild and the mitigation itself isn't too invasive.
2025-06-30 19:23:16 +08:00
Matthias Krüger
eef87fd974 Rollup merge of #142889 - nabijaczleweli:rusts, r=Mark-Simulacrum
Clarify doc comment on unix OpenOptions
2025-06-29 06:59:29 +02:00
Matthias Krüger
02cb521cbf Rollup merge of #143082 - fee1-dead-contrib:push-qvvppzukvkxt, r=Mark-Simulacrum
update internal `send_signal` comment

the vxwork did not have the old comment updated in rust-lang/rust#141990 so update here;

signaling -> sending signals to because the latter reads better to me.
2025-06-28 22:05:31 +02:00
Matthias Krüger
7394bd5fc2 Rollup merge of #123476 - devnexen:std_net_solaris_exclbind, r=Mark-Simulacrum
std::net: adding `unix_socket_exclbind` feature for solaris/illumos.

allows to have a tigher control over the binding exclusivness of the socket.

ACP: https://github.com/rust-lang/libs-team/issues/366
2025-06-28 22:05:27 +02:00
наб
45204ef4f4 "set by Rusts options". Remove misleading always-true if cfg!(unix). Drop #![feature(rustc_private)] 2025-06-28 17:57:57 +02:00
Chris Denton
953cf27c7a Workaround for mem safety in third party dlls 2025-06-28 09:59:42 +00:00
Matthias Krüger
9d15167921 Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkov
Reduce special casing for the panic runtime

See the individual commits for more info.
2025-06-27 22:13:01 +02:00
Kurt Heiritz (pseudo)
06fb36c92e Update poison.rs to fix the typo (sys->sync) 2025-06-27 16:26:53 +05:30
Deadbeef
7a79454de4 update internal send_signal comment 2025-06-27 18:24:42 +08:00
bors
e61dd437f3 Auto merge of #143074 - compiler-errors:rollup-cv64hdh, r=compiler-errors
Rollup of 18 pull requests

Successful merges:

 - rust-lang/rust#137843 (make RefCell unstably const)
 - rust-lang/rust#140942 (const-eval: allow constants to refer to mutable/external memory, but reject such constants as patterns)
 - rust-lang/rust#142549 (small iter.intersperse.fold() optimization)
 - rust-lang/rust#142637 (Remove some glob imports from the type system)
 - rust-lang/rust#142647 ([perf] Compute hard errors without diagnostics in impl_intersection_has_impossible_obligation)
 - rust-lang/rust#142700 (Remove incorrect comments in `Weak`)
 - rust-lang/rust#142927 (Add note to `find_const_ty_from_env`)
 - rust-lang/rust#142967 (Fix RwLock::try_write documentation for WouldBlock condition)
 - rust-lang/rust#142986 (Port `#[export_name]` to the new attribute parsing infrastructure)
 - rust-lang/rust#143001 (Rename run always )
 - rust-lang/rust#143010 (Update `browser-ui-test` version to `0.20.7`)
 - rust-lang/rust#143015 (Add `sym::macro_pin` diagnostic item for `core::pin::pin!()`)
 - rust-lang/rust#143033 (Expand const-stabilized API links in relnotes)
 - rust-lang/rust#143041 (Remove cache for citool)
 - rust-lang/rust#143056 (Move an ACE test out of the GCI directory)
 - rust-lang/rust#143059 (Fix 1.88 relnotes)
 - rust-lang/rust#143067 (Tracking issue number for `iter_macro`)
 - rust-lang/rust#143073 (Fix some fixmes that were waiting for let chains)

Failed merges:

 - rust-lang/rust#143020 (codegen_fn_attrs: make comment more precise)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-27 00:44:20 +00:00