Commit graph

25314 commits

Author SHA1 Message Date
Josh Stone
faf3e0b589 Further revert Deref for Cow to its 1.90.0 state
ref: https://github.com/rust-lang/rust/issues/147964#issuecomment-3446420995
2025-10-28 08:41:14 -07:00
Josh Stone
912aba6874 Revert "feat: implement hash_map! macro"
This reverts commit 066023e47c.

(cherry picked from commit c01682ebf6)
2025-10-24 10:13:04 -07:00
Josh Stone
4bc789b5b1 Add a regression test for rust-lang/rust#147971
(cherry picked from commit a81ed52f58)
2025-10-24 10:13:04 -07:00
ltdk
566809897f Revert inference failure from Deref/Borrow constification
(cherry picked from commit ebd5bea84f)
2025-10-24 10:12:43 -07:00
ltdk
b6d30faa79 Revert inference failure from AsRef constification
(cherry picked from commit cb7fb35ad1)
2025-10-24 10:12:37 -07:00
Iris Shi
6271db5ab5 Fix infinite recursion in Path::eq with String
(cherry picked from commit 5a4e536036)
2025-10-07 15:41:15 -07:00
Nikita Popov
186d91daf7 Revert "Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic"
This reverts commit 040a98af70, reversing
changes made to e8a792daf5.
2025-09-25 16:36:51 +02:00
Mark Rousskov
03265b459f Update CURRENT_RUSTC_VERSION post-bump 2025-09-14 14:43:32 -04:00
Jacob Pratt
da1c27df16
Rollup merge of #146521 - folkertdev:document-va-arg-safe, r=workingjubilee
document `core::ffi::VaArgSafe`

tracking issue: https://github.com/rust-lang/rust/issues/44930

A modification of https://github.com/rust-lang/rust/pull/146454, keeping just the documentation changes, but not unsealing the trait.

Although conceptually we'd want to unseal the trait, there are many edge cases to supporting arbitrary types. We'd need to exhaustively test that all targets/calling conventions support all types that rust might generate (or generate proper error messages for unsupported cases). At present, many of the `va_arg` implementations assume that the argument is a scalar, and has an alignment of at most 8. That is totally  sufficient for an MVP (accepting all of the "standard" C types), but clearly does not cover all rust types.

This PR also adds some various other tests for edge cases of c-variadic:

- the `#[inline]` attribute in its various forms. At present, LLVM is unable to inline c-variadic functions, but the attribute should still be accepted. `#[rustc_force_inline]` already rejects c-variadic functions.
- naked functions should accept and work with a C variable argument list. In the future we'd like to allow more ABIs with naked functions (basically, any ABI for which we accept defining foreign c-variadic functions), but for now only  `"C"` and `"C-unwind` are supported
- guaranteed tail calls: c-variadic functions cannot be tail-called. That was already rejected, but there was not test for it.

r? `@workingjubilee`
2025-09-13 18:55:20 -04:00
Jacob Pratt
08db93806b
Rollup merge of #146517 - RalfJung:wait-timeout, r=joboet
fix Condvar::wait_timeout docs

[Context](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Condvar.20wait_timeout.20sleep.20duration.20decremented/with/539279839)
r? `@joboet`
2025-09-13 18:55:19 -04:00
Jacob Pratt
5d56e52409
Rollup merge of #146473 - RalfJung:system-time-deconst, r=workingjubilee
Revert "Constify SystemTime methods"

This reverts https://github.com/rust-lang/rust/pull/144519. The const-hacks introduces bugs, and they make the code harder to maintain. Let's wait until we can constify these functions without changing their implementation.

Fixes https://github.com/rust-lang/rust/issues/146228.
Closes https://github.com/rust-lang/rust/issues/144517 (since the feature is gone).
r? `@tgross35`
Cc `@clarfonthey`
2025-09-13 18:55:18 -04:00
Folkert de Vries
61a3593786
c-variadic: document core::ffi::VaArgSafe
and document `VaList::arg`.
2025-09-13 21:04:58 +02:00
Ralf Jung
f21d3fbce9 fix Condvar::wait_timeout docs 2025-09-13 20:13:37 +02:00
Waffle Lapkin
f13c8c2192
fixup become kw documentation wrt #[track_caller] 2025-09-13 19:48:10 +02:00
Maybe Waffle
cc9225406c
Document become keyword 2025-09-13 19:48:07 +02:00
Ralf Jung
2baa39e89f also apply revert to wasip2 2025-09-13 10:41:59 +02:00
Jacob Pratt
5b37a1e4ae
Rollup merge of #145471 - rs-sac:extr, r=the8472
Stabilize BTree{Map,Set}::extract_if

Tracking issue: rust-lang/rust#70530
FCP completed: https://github.com/rust-lang/rust/issues/70530#issuecomment-3191454465
Closes: rust-lang/rust#70530
2025-09-13 03:26:02 -04:00
Jana Dönszelmann
ec0f3bd2ed
Rollup merge of #146481 - ferrocene:pvdrz/improve-hash-coverage, r=jhpratt
Improve `core::hash` coverage

This PR improves the `core::hash` coverage by adding a new test to `coretests` and extending one of the existing tests to use 128-bit integers

r? libs
2025-09-13 02:40:46 +02:00
Jana Dönszelmann
7928be014c
Rollup merge of #146477 - ferrocene:pvdrz/improve-char-coverage, r=Noratrieb
Improve `core::char` coverage

This PR improves the `core::char` coverage by adding new tests to `coretests`

r? ``@workingjubilee``
2025-09-13 02:40:45 +02:00
Jana Dönszelmann
e4dbbbd322
Rollup merge of #146452 - ferrocene:pvdrz/improve-alloc-coverage, r=tgross35
Improve `alloc::Layout` coverage

This PR improves the `core::alloc` coverage by adding a new test to `coretests` that cover the `Layout` methods when they error.

Tracking issue: https://github.com/rust-lang/rust/issues/55724
2025-09-13 02:40:45 +02:00
Christian Poveda
79643ad48a
Improve core::hash coverage 2025-09-12 13:54:15 -05:00
bors
5c11fb842a Auto merge of #144847 - Randl:const-ord, r=oli-obk
Constify Eq, Ord, PartialOrd

Adds `#[const_trait]` and impls for `Eq`, `Ord`, `PartialOrd`. Impl for some other traits (e.g., slices and arrays) are blocked mainly on const closures (https://github.com/rust-lang/rust/issues/106003).
For TypeId Ord we need const pointer comparison (https://github.com/rust-lang/rust/issues/53020)
Tracking issue https://github.com/rust-lang/rust/issues/143800
2025-09-12 17:34:52 +00:00
Christian Poveda
51e3b6238d
Improve core::char coverage 2025-09-12 11:22:07 -05:00
Christian Poveda
18059a0053
Improve core::alloc coverage 2025-09-12 10:49:52 -05:00
Ralf Jung
5d8e41b656 Revert "Constify SystemTime methods"
This reverts commit 7ce620dd7c.
The const-hacks introduces bugs, and they make the code harder to maintain.
Let's wait until we can constify these functions without changing their implementation.
2025-09-12 17:16:38 +02:00
bors
408eacfb95 Auto merge of #146468 - Zalathar:rollup-6u3s44d, r=Zalathar
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#144549 (match clang's `va_arg` assembly on arm targets)
 - rust-lang/rust#145895 (thread parking: fix docs and examples)
 - rust-lang/rust#146308 (support integer literals in `${concat()}`)
 - rust-lang/rust#146323 (check before test for hardware capabilites in bits 32~63 of usize)
 - rust-lang/rust#146332 (tidy: make behavior of extra-checks more uniform)
 - rust-lang/rust#146374 (Update `browser-ui-test` version to `0.22.2`)
 - rust-lang/rust#146413 (Improve suggestion in case a bare URL is surrounded by brackets)
 - rust-lang/rust#146426 (Bump miow to 0.60.1)
 - rust-lang/rust#146432 (Implement `Socket::take_error` for Hermit)
 - rust-lang/rust#146433 (rwlock tests: fix miri macos test regression)
 - rust-lang/rust#146435 (Change the default value of `gcc.download-ci-gcc` to `true`)
 - rust-lang/rust#146439 (fix cfg for poison test macro)
 - rust-lang/rust#146448 ([rustdoc] Correctly handle literal search on paths)
 - rust-lang/rust#146449 (Fix `libgccjit` symlink when we build GCC locally)
 - rust-lang/rust#146455 (test: remove an outdated normalization for rustc versions)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-12 11:27:07 +00:00
Stuart Cook
2e51a38999
Rollup merge of #146439 - connortsui20:fix-sync-macro-attr, r=RalfJung
fix cfg for poison test macro

Fixes test regression in https://github.com/rust-lang/rust/pull/144648
Continuation of https://github.com/rust-lang/rust/pull/146433

I think this is right? Not really sure how to test this myself to be honest.

r? ```@RalfJung```

I'll also leave the improvement to the test macro for a separate PR (described [here](https://github.com/rust-lang/rust/pull/146433#issuecomment-3280210451)) since I've never done something like that before. Though since this fixes all of the tests, it might not be necessary since anyone in the future will see the `cfg()` and not `cfg_attr()`?
2025-09-12 20:02:17 +10:00
Stuart Cook
312e15fb3e
Rollup merge of #146433 - RalfJung:rwlock-miri, r=tgross35
rwlock tests: fix miri macos test regression

https://github.com/rust-lang/rust/pull/144648 broke the attributes that ignore the tests on Miri; this patch should fix that.
2025-09-12 20:02:16 +10:00
Stuart Cook
f40d78f57e
Rollup merge of #146432 - hermit-os:hermit-take_error, r=joboet
Implement `Socket::take_error` for Hermit

This PR fixes an unused-imports compilation error introduced in 845311a065 and implements `Socket::take_error` for Hermit.

Hermit's `Socket::take_error` implementation works exactly like the one for Unix.

r? joboet
2025-09-12 20:02:15 +10:00
Stuart Cook
7429420eef
Rollup merge of #146323 - h3fang:issue-146230-fix, r=Amanieu
check before test for hardware capabilites in bits 32~63 of usize

This commit tries to fix https://github.com/rust-lang/rust/issues/146230.

`std::arch::is_aarch64_feature_detected` panics on aarch64 ILP32 targets.

After some digging, the real problem is

91edc3ebcc/library/std_detect/src/detect/os/linux/aarch64.rs (L210-L241)

checks bits 32~63 of usize unconditionally on normal aarch64 LP64 target and aarch64 ILP32 target.

Here I propose to move these to a block guarded by `#[cfg(target_pointer_width="64")]`.

See rust-lang/rust#146230 for more detailed analysis.

r?  ```@Amanieu```
2025-09-12 20:02:12 +10:00
Stuart Cook
1037c082bc
Rollup merge of #145895 - RalfJung:unpark, r=joboet
thread parking: fix docs and examples

Fixes https://github.com/rust-lang/rust/issues/145816

r? ```@joboet```
Cc ```@m-ou-se``` ```@Amanieu```
2025-09-12 20:02:10 +10:00
Evgenii Zheltonozhskii
ff9b1c1d28 Constify Eq, Ord, PartialOrd 2025-09-12 12:39:31 +03:00
bors
ac4495a10d Auto merge of #146019 - joboet:better-dlsym, r=tgross35
std: optimize `dlsym!` macro and add a test for it

The `dlsym!` macro always ensures that the name string is nul-terminated, so there is no need to perform the check at runtime. Also, acquire loads are generally faster than a load and a barrier, so use them. This is only false in the case where the symbol is missing, but that shouldn't matter too much.
2025-09-12 08:18:41 +00:00
Fang He
4c849c73a4 fix typo in comment 2025-09-12 08:18:26 +08:00
bors
2a9bacf618 Auto merge of #145177 - joboet:move-pal-thread, r=ibraheemdev
std: move `thread` into `sys`

Part of https://github.com/rust-lang/rust/issues/117276.
2025-09-11 22:31:43 +00:00
Connor Tsui
6354c51d2b
update doc comment
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-11 13:08:44 -04:00
Connor Tsui
18d0dcbc8e
fix config for poison macro test
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2025-09-11 12:35:26 -04:00
Ralf Jung
092802640f rwlock tests: fix miri macos test regression 2025-09-11 10:04:32 +02:00
Martin Kröning
af5355cc91
Implement Socket::take_error for Hermit 2025-09-11 09:05:17 +02:00
Martin Kröning
9fe101b6ea
Remove unused import from sys/pal/hermit/os.rs
This fixes

```
error: unused import: `str`
 --> library/std/src/sys/pal/hermit/os.rs:6:22
  |
6 | use crate::{fmt, io, str};
  |                      ^^^
  |
  = note: `-D unused-imports` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_imports)]`
```

This was caused by 845311a065.
2025-09-11 09:05:17 +02:00
Stuart Cook
5258dfc0b7
Rollup merge of #146425 - ferrocene:pvdrz/improve-array-coverage, r=workingjubilee
Improve `core::array` coverage

This PR improves the `core::array` coverage by adding new tests to `coretests`
2025-09-11 14:06:33 +10:00
Stuart Cook
81840271c3
Rollup merge of #146424 - ferrocene:pvdrz/improve-ops-coverage, r=workingjubilee
Improve `core::ops` coverage

This PR improves the `core::ops` coverage by adding new tests to `coretests`
2025-09-11 14:06:32 +10:00
Stuart Cook
c69a792137
Rollup merge of #146380 - rperier:unify_and_dedup_bits_conv_float_tests, r=tgross35
Unify and deduplicate bits conv float tests

cc rust-lang/rust#141726

This is a proposal to unify and deduplicate the bits conv tests for f16, f32, f64 and f128
2025-09-11 14:06:30 +10:00
Stuart Cook
c79c990df1
Rollup merge of #146379 - madsmtm:fix-platform_version-test, r=tgross35
Fix `compare_against_sw_vers` test

The `saturating_sub` doesn't actually perform its intended since the version numbers are signed integers (which I changed in a later revision of https://github.com/rust-lang/rust/pull/138944).

Fixes the issue described in https://github.com/rust-lang/rust/pull/138944#issuecomment-3270662876.

r? tgross35
2025-09-11 14:06:29 +10:00
Stuart Cook
602841dc8c
Rollup merge of #142315 - lolbinarycat:core-dedup-ptr-docs-139190-pt3, r=workingjubilee
core::ptr: deduplicate docs for as_ref, addr, and as_uninit_ref

also add INFO.md file explaining the purpose of the ptr/docs dir, and give some pointers (heh) to future maintainers.

follow up to rust-lang/rust#142101

part of rust-lang/rust#139190

r? `@workingjubilee`
2025-09-11 14:06:26 +10:00
Christian Poveda
a7528e7ec3
Improve core::array coverage 2025-09-10 17:25:24 -05:00
Christian Poveda Ruiz
789c8408ec
Update library/coretests/tests/ops.rs
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-09-10 16:50:45 -05:00
Christian Poveda
5f2b04652f
Improve core::ops coverage 2025-09-10 16:32:04 -05:00
Matthias Krüger
d061896a37
Rollup merge of #146322 - weiznich:fix/146087, r=joboet
Make Barrier RefUnwindSafe again

This commit manually implements `RefUnwindSafe` for `std::sync::Barrier` to fix rust-lang/rust#146087. This is a fix for a regression indroduced by e95db591a4
2025-09-10 20:29:07 +02:00
Matthias Krüger
e79630da0b
Rollup merge of #145327 - joboet:net-addr-sgx-hack, r=tgross35
std: make address resolution weirdness local to SGX

Currently, the implementations of `TcpStream::connect` and its cousins take an `io::Result<&SocketAddr>` as argument, which is very weird, as most of them then `?`-try the result immediately to access the actual address. This weirdness is however necessitated by a peculiarity of the SGX networking implementation:

SGX doesn't support DNS resolution but rather accepts hostnames in the same place as socket addresses. So, to make e.g.
```rust
TcpStream::connect("example.com:80")`
```
work, the DNS lookup returns a special error (`NonIpSockAddr`) instead, which contains the hostname being looked up. When `.to_socket_addrs()` fails, the `each_addr` function used to select an address will pass the error to the inner `TcpStream::connect` implementation, which in SGX's case will inspect the error and try recover the hostname from it. If
that succeeds, it continues with the found hostname.

This is pretty obviously a terrible hack and leads to buggy code (for instance, when users use the result of `.to_socket_addrs()` in their own `ToSocketAddrs` implementation to select from a list of possible URLs, the only URL used will be that of the last item tried). Still, without changes to the SGX usercall ABI, it cannot be avoided.

Therefore, this PR aims to minimise the impact of that weirdness and remove it from all non-SGX platforms. The inner `TcpStream::connect`, et al. functions now receive the `ToSocketAddrs` type directly and call `each_addr` (which is moved to `sys::net::connection`) themselves. On SGX, the implementation uses a special `each_addr` which contains the whole pass-hostname-through-error hack.

As well as making the code cleaner, this also opens up the possibility of reusing newly created sockets even if a connection request fails – but I've left that for another PR.

CC `@raoulstrackx`
2025-09-10 20:29:04 +02:00