Commit Graph

8375 Commits

Author SHA1 Message Date
Mara Bos
bd44d855f5 Link to payload_as_str() from payload(). 2025-08-12 12:50:48 +02:00
Ayush Singh
35906eaabc std: sys: pal: uefi: tests: Add systemtime tests
Add tests to ensure that extream system times are still representable.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-08-11 19:10:10 +05:30
Ayush Singh
0ccbe8fc71 std: sys: pal: uefi: Overhaul Time
Use a time representation with 1900-01-01-00:00:00 at timezone -1440 min as
anchor. This is the earliest time supported in UEFI.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-08-11 18:58:34 +05:30
Stuart Cook
fd7d724559 Rollup merge of #145228 - estebank:unnecessary-parens, r=joshtriplett
Remove unnecessary parentheses in `assert!`s
2025-08-11 12:21:10 +10:00
Stuart Cook
3724e13cc7 Rollup merge of #144350 - Ayush1325:uefi-io, r=tgross35,nicholasbishop
std: sys: io: io_slice: Add UEFI types

UEFI networking APIs do support vectored read/write. While the types for UDP4, UDP6, TCP4 and TCP6 are defined separately, they are essentially the same C struct. So we can map IoSlice and IoSliceMut to have the same binary representation.

Since all UEFI networking types for read/write are DSTs, `IoSlice` and `IoSliceMut` will need to be copied to the end of the transmit/receive structures. So having the same binary representation just allows us to do a single memcpy instead of having to loop and set the DST.

cc ``@nicholasbishop``
2025-08-11 12:21:07 +10:00
Esteban Küber
74c3727b1f Remove unnecessary parentheses in assert!s 2025-08-10 21:59:04 +00:00
Jacob Pratt
adf522cefb Rollup merge of #145150 - ChrisDenton:inherit, r=Mark-Simulacrum
Replace unsafe `security_attributes` function with safe `inherit_handle` alternative

The `security_attributes` function is marked as safe despite taking a raw pointer which will later be used. Fortunately this function is only used internally and only in one place that has been basically the same for a decade now. However, we only ever set one bool so it's easy enough to replace with something that's actually safe.

In the future we might want to expose the ability for users to set security attributes. But that should be properly designed (and safe!).
2025-08-10 15:43:54 -04:00
Josh Triplett
c503487a6f Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere
`typos.toml` has an exception for "numer", to avoid flagging its use as
an abbreviation for "numerator". Remove the use of that abbrevation,
spelling out "numerator" instead, and remove the exception, so that typo
checks can find future instances of "numer" as a typo for "number".
2025-08-09 15:01:58 -07:00
Ada Alakbarova
06e43655bc HashMap: also add "Usage with custom key types" heading 2025-08-09 19:41:41 +02:00
Ada Alakbarova
c0a3e4802a {BTree,Hash}Map: add "Entry API" section heading 2025-08-09 19:41:32 +02:00
Chris Denton
89b366955e Replace unsafe function with safe alternative
The `security_attributes` function is marked as safe despite taking a raw pointer which will later be used. Fortunately this function is only used internally and only in one place that has been basically the same for a decade now.

However, we only ever set one bool so it's easy enough to replace with something that's actually safe.
2025-08-09 07:05:12 +00:00
Connor Tsui
ad499d076a add nonpoison and poison rwlock tests
Adds tests for the `nonpoison::RwLock` variant by using a macro to
duplicate the existing `poison` tests.

Note that all of the tests here are adapted from the existing `poison`
tests.
2025-08-09 08:41:27 +02:00
Connor Tsui
d8a0df075d reorganize rwlock tests
This commit simply helps discern the actual changes needed to test both
poison and nonpoison `rwlock`s.
2025-08-09 08:41:27 +02:00
Connor Tsui
4b7e904fa4 add nonpoison::rwlock implementation
Adds the equivalent `nonpoison` types to the `poison::rwlock` module.
These types and implementations are gated under the `nonpoison_rwlock`
feature gate.

Also blesses the ui tests that now have a name conflicts (because these
types no longer have unique names). The full path distinguishes the
different types.
2025-08-09 08:41:26 +02:00
Connor Tsui
d710a8e8d7 reorganize rwlock file
This commit is a purely cosmetic change to the documentation and
ordering of items in the `rwlock.rs` file, which will help discern the
actual difference between the `nonpoison` and `poison` variants of
`rwlock`.

List of changes (lots of small things):

- Clean up some of the existing field doc comments
- Add documentation for every field in struct definitions
- Consolidate related implementation blocks (1 implementation block per
  guard instead of 2)
- Use the lifetime name `'rwlock` instead of `'a`
- Reorder implementation blocks to be consistent across the entire file
  (follows the order `ReadGuard`, `WriteGuard`, `MappedReadGuard`,
  MappedWriteGuard`)
- Move simple trait implementations to the bottom of the file
- Rename the `poison` field in `MappedRwLockWriteGuard` to
  posion_guard`
- Cut off comments at 100 columns
- Update the documentation of `downgrade` to match stabilization PR #
  143191
2025-08-09 08:16:51 +02:00
Stuart Cook
f47557c4a7 Rollup merge of #145096 - Spxg:w/wasm_atomic, r=tgross35
Fix wasm target build with atomics feature

Introduced by https://github.com/rust-lang/rust/pull/115746

close https://github.com/rust-lang/rust/issues/145101
2025-08-09 13:58:51 +10:00
Jakub Beránek
8fcfbcd868 Revert "Rollup merge of #143906 - LorrensP-2158466:miri-float-nondet-foreign-items, r=RalfJung"
This reverts commit 71f04692c3, reversing
changes made to 995ca3e532.
2025-08-08 19:16:48 +02:00
Spxg
c3e504d399 Fix wasm target build with atomics feature 2025-08-08 22:45:25 +08:00
minxuanz
d47b5e4ab6 Fix wrong cache line size of riscv64 2025-08-08 11:19:04 +08:00
Trevor Gross
338a3e0b21 Rollup merge of #145046 - ulrichstark:master, r=tgross35
Fix doc comment of File::try_lock and File::try_lock_shared

The doc comments of functions `File::try_lock` and `File::try_lock_shared` stabilized today in version 1.89.0 document an incorrect type of `Ok`.

The result type was changed in rust-lang/rust#139343 after the latest change to the doc comments in rust-lang/rust#136876.
2025-08-07 19:36:39 -05:00
Trevor Gross
2e0e183147 Rollup merge of #144903 - Kivooeo:panic_handler-is-not-begin, r=m-ou-se
Rename `begin_panic_handler` to `panic_handler`

Part of https://github.com/rust-lang/rust/issues/116005
2025-08-07 19:36:36 -05:00
Trevor Gross
1d71dc4f26 Rollup merge of #144900 - Kivooeo:unsigned_signed_diff-stabilize, r=dtolnay
Stabilize `unsigned_signed_diff` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/126041) and stabilises `checked_signed_diff`

Closes: https://github.com/rust-lang/rust/issues/126041
2025-08-07 19:36:36 -05:00
Trevor Gross
a8f36867e0 Rollup merge of #144705 - pmur:murp/aarch64-lse, r=Amanieu
compiler-builtins: plumb LSE support for aarch64 on linux/gnu when optimized-compiler-builtins not enabled

Add dynamic support for aarch64 LSE atomic ops on linux/gnu targets when optimized-compiler-builtins is not enabled.

Enabling LSE is the primary motivator for rust-lang/rust#143689, though extending the rust version doesn't seem too farfetched. Are there more details which I have overlooked which make this impractical? I've tested this on an aarch64 host with LSE.

r? ```````@tgross35```````
2025-08-07 19:36:35 -05:00
bors
321a89bec5 Auto merge of #145043 - Zalathar:rollup-3dbvdrm, r=Zalathar
Rollup of 19 pull requests

Successful merges:

 - rust-lang/rust#137831 (Tweak auto trait errors)
 - rust-lang/rust#138689 (add nvptx_target_feature)
 - rust-lang/rust#140267 (implement continue_ok and break_ok for ControlFlow)
 - rust-lang/rust#143028 (emit `StorageLive` and schedule `StorageDead` for `let`-`else`'s bindings after matching)
 - rust-lang/rust#143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order)
 - rust-lang/rust#143808 (Port `#[should_panic]` to the new attribute parsing infrastructure )
 - rust-lang/rust#143906 (Miri: non-deterministic floating point operations in `foreign_items`)
 - rust-lang/rust#143929 (Mark all deprecation lints in name resolution as deny-by-default and report-in-deps)
 - rust-lang/rust#144133 (Stabilize const TypeId::of)
 - rust-lang/rust#144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny)
 - rust-lang/rust#144439 (Introduce ModernIdent type to unify macro 2.0 hygiene handling)
 - rust-lang/rust#144473 (Address libunwind.a inconsistency issues in the bootstrap program)
 - rust-lang/rust#144601 (Allow `cargo fix` to partially apply `mismatched_lifetime_syntaxes`)
 - rust-lang/rust#144650 (Additional tce tests)
 - rust-lang/rust#144659 (bootstrap: refactor mingw dist and fix gnullvm)
 - rust-lang/rust#144682 (Stabilize `strict_overflow_ops`)
 - rust-lang/rust#145026 (Update books)
 - rust-lang/rust#145033 (Reimplement `print_region` in `type_name.rs`.)
 - rust-lang/rust#145040 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#143857 (Port #[macro_export] to the new attribute parsing infrastructure)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-07 14:01:43 +00:00
Ulrich Stark
4888762816 Fix doc comment of File::try_lock and File::try_lock_shared 2025-08-07 14:13:11 +02:00
bors
cd434309ef Auto merge of #144997 - BoxyUwU:bootstrap_bump, r=Mark-Simulacrum
bump bootstrap compiler to 1.90 beta

There were significantly less `cfg(bootstrap)` and `cfg(not(bootstrap))` this release. Presumably due to the fact that we change the bootstrap stage orderings to reduce the need for them and it was successful 🙏
2025-08-07 10:56:05 +00:00
Stuart Cook
71f04692c3 Rollup merge of #143906 - LorrensP-2158466:miri-float-nondet-foreign-items, r=RalfJung
Miri: non-deterministic floating point operations in `foreign_items`

Part of [rust-lang/miri/#3555](https://github.com/rust-lang/miri/issues/3555#issue-2278914000), this pr does the `foreign_items` work.

Some things have changed since rust-lang/rust#138062 and rust-lang/rust#142514. I moved the "helpers" used for creating fixed outputs and clamping operations to their defined ranges to `math.rs`. These are now also extended to handle the floating-point operations in `foreign_items`. Tests in `miri/tests/float.rs` were changed/added.

Failing tests in `std` were extracted, run under miri with `-Zmiri-many-seeds=0..1000` and changed accordingly. Double checked with `-Zmiri-many-seeds`.

I noticed that the C standard doesn't specify the output ranges for all of its mathematical operations; it just specifies them as:
```
Returns
The sinh functions return sinh x.
```
So I used [Wolfram|Alpha](https://www.wolframalpha.com/).
2025-08-07 20:49:41 +10:00
bors
61cb1e97fc Auto merge of #115746 - tgross35:unnamed-threads-panic-message, r=cuviper
Print thread ID in panic message

`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.

This changes the panic message from something like this:

    thread '<unnamed>' panicked at src/main.rs:3:5:
    explicit panic

To something like this:

    thread '<unnamed>' (12345) panicked at src/main.rs:3:5:
    explicit panic

Stack overflow messages are updated as well.

This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: dist-apple-various
try-job: dist-various-*
try-job: dist-x86_64-freebsd
try-job: dist-x86_64-illumos
try-job: dist-x86_64-netbsd
try-job: dist-x86_64-solaris
try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-mingw-1
try-job: x86_64-msvc-1
2025-08-07 02:32:55 +00:00
Trevor Gross
289fe36d37 Print thread ID in panic message if thread name is unknown
`panic!` does not print any identifying information for threads that are
unnamed. However, in many cases, the thread ID can be determined.

This changes the panic message from something like this:

    thread '<unnamed>' panicked at src/main.rs:3:5:
    explicit panic

To something like this:

    thread '<unnamed>' (0xff9bf) panicked at src/main.rs:3:5:
    explicit panic

Stack overflow messages are updated as well.

This change applies to both named and unnamed threads. The ID printed is
the OS integer thread ID rather than the Rust thread ID, which should
also be what debuggers print.
2025-08-06 23:59:47 +00:00
Guillaume Gomez
094b893f77 Rollup merge of #144975 - joshtriplett:file-times-dir, r=jhpratt
`File::set_times`: Update documentation and example to support setting timestamps on directories

Inspired by https://github.com/rust-lang/rust/issues/123883 .
2025-08-06 21:29:32 +02:00
Guillaume Gomez
09de71b61c Rollup merge of #144972 - the8472:file-prefix-docs, r=joshtriplett
add code example showing that file_prefix treats dotfiles as the name of a file, not an extension

This came up in a libs-api meeting while we were reviewing rust-lang/rust#144870
2025-08-06 21:29:31 +02:00
Guillaume Gomez
5209bc6661 Rollup merge of #144861 - Kivooeo:payload-as-str-stabilization, r=ChrisDenton
Stabilize `panic_payload_as_str` feature

Closes [tracking issue](https://github.com/rust-lang/rust/issues/125175).

Part of https://github.com/rust-lang/rust/issues/116005.

FCP ended more than year ago in tracking issue, I'm not sure if we should rerun it.
2025-08-06 21:29:28 +02:00
Josh Triplett
e597071cbf Reword documentation for set_times to clarify directory handling 2025-08-06 11:41:16 -07:00
LorrensP-2158466
71add2f5f7 Change stdlib float tests to account for miri nondet floats. 2025-08-06 17:21:04 +02:00
ginnyTheCat
a7e8fe7311 Clarify EOF handling for BufRead::skip_until 2025-08-06 16:52:43 +02:00
Jakub Beránek
bde39e58d6 Rollup merge of #144836 - chotchki:patch-1, r=tgross35
Change visibility of Args new function

Currently the Args new function is constrained to pub(super) but this stops me from being able to construct Args structs in unit tests.

This pull request is to change this to pub.
2025-08-06 15:55:44 +02:00
Boxy
9ccc9f177e replace version placeholder 2025-08-06 13:22:38 +01:00
Josh Triplett
a99860b13a File::set_times: Add documentation about setting directory timestamps
Inspired by https://github.com/rust-lang/rust/issues/123883 .
2025-08-05 15:10:24 -07:00
Josh Triplett
1bb14a8bb7 File::set_times: Remove write(true) from the example so it works on directories
Inspired by https://github.com/rust-lang/rust/issues/123883 .
2025-08-05 15:09:33 -07:00
The 8472
d8e8a5e8b4 add code example showing that file_prefix treats dotfiles as the name of a file, not an extension 2025-08-05 22:56:43 +02:00
Paul Murphy
6936bb975a Dynamically enable LSE for aarch64 rust provided intrinsics
Create a private module to hold the bootstrap code needed enable LSE
at startup on aarch64-*-linux-* targets when rust implements the
intrinsics.

This is a bit more heavyweight than compiler-rt's LSE initialization,
but has the benefit of initializing the aarch64 cpu feature detection
for other uses.

Using the rust initialization code does use some atomic operations,
that's OK. Mixing LSE and non-LSE operations should work while the
update flag propagates.
2025-08-05 10:35:13 -05:00
Raoul Strackx
3a993a611c Ignore sleep_until test on SGX 2025-08-05 14:51:39 +02:00
Samuel Tardieu
1724af9f1e Rollup merge of #144872 - connortsui20:once-poison-docs, r=Amanieu
Document Poisoning in `LazyCell` and `LazyLock`

Currently, there is no documentation of poisoning behavior in either `LazyCell` or `LazyLock`, even though both of them can be observed as poisoned by users.

`LazyCell` [plagyround example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=9cf38b8dc56db100848f54085c2c697d)

`LazyLock` [playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f1cd6f9fe16636e347ebb695a0ce30c0)

# Open Questions

- [x] Is it worth making the implementation of `LazyLock` more complicated to ensure that the the panic message is `"LazyLock instance has previously been poisoned"` instead of `"Once instance has previously been poisoned"`? See the `LazyLock` playground link above for more context.
- [x] Does it make sense to move `LazyLock` into the `poison` module? It is certainly a poison-able type, but at the same time it is slightly different from the 4 other types currently in the `poison` module in that it is unrecoverable. I think this is more of a libs-api question.

``@rustbot`` label +T-libs-api

Please let me know if these open questions deserve a separate issue / PR!
2025-08-05 03:51:38 +02:00
Samuel Tardieu
d2fcd71be6 Rollup merge of #144852 - Kivooeo:rename-panic, r=m-ou-se
Rename `rust_panic_without_hook` to `resume_unwind`

part of https://github.com/rust-lang/rust/issues/116005

r? libs
2025-08-05 03:51:37 +02:00
Ayush Singh
6e75abd0aa std: sys: io: io_slice: Add UEFI types
UEFI networking APIs do support vectored read/write. While the types for
UDP4, UDP6, TCP4 and TCP6 are defined separately, they are essentially
the same C struct. So we can map IoSlice and IoSliceMut to have the same
binary representation.

Since all UEFI networking types for read/write are DSTs, `IoSlice` and
`IoSliceMut` will need to be copied to the end of the transmit/receive
structures. So having the same binary representation just allows us to
do a single memcpy instead of having to loop and set the DST.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-08-04 20:02:01 +05:30
Kivooeo
b7f5392946 remove begin prefix 2025-08-04 18:25:34 +05:00
Kivooeo
d2cfe486f0 remove feature gate 2025-08-04 16:41:10 +05:00
Stuart Cook
7fbb303147 Rollup merge of #144853 - Kivooeo:rust_-cleanup, r=Mark-Simulacrum
Remove unnecessary `rust_` prefixes

part of https://github.com/rust-lang/rust/issues/116005

Honestly, not sure if this can affect linking somehow, also I didn't touched things like `__rust_panic_cleanup` and `__rust_start_panic` which very likely will break something, so just small cleanup here

also didn't changed `rust_panic_without_hook` because it was renamed here https://github.com/rust-lang/rust/pull/144852

r? libs
2025-08-04 11:24:42 +10:00
Stuart Cook
e65201ccb8 Rollup merge of #144188 - joshtriplett:available-parallelism, r=Mark-Simulacrum
`available_parallelism`: Add documentation for why we don't look at `ulimit`
2025-08-04 11:24:36 +10:00
Kivooeo
4c4b8b23c6 remove gate 2025-08-04 02:18:18 +05:00