Commit Graph

18292 Commits

Author SHA1 Message Date
Matthias Krüger
8152da82b5
Rollup merge of #137873 - tgross35:disable-f16-without-neon, r=workingjubilee
Disable `f16` on Aarch64 without `neon`

LLVM has crashes at some `half` operations when built with assertions enabled if fp-armv8 is not available [1]. Things seem to usually work, but we are reaching LLVM undefined behavior so this needs to be disabled.

[1]: https://github.com/llvm/llvm-project/issues/129394
2025-03-02 22:44:26 +01:00
Matthias Krüger
c994a29392
Rollup merge of #137871 - pitaj:rangebounds-is_empty-intersect, r=scottmcm
fix `RangeBounds::is_empty` documentation

One-sided ranges are never empty

follow-up for https://github.com/rust-lang/rust/pull/137304#pullrequestreview-2646899461
2025-03-02 22:44:26 +01:00
Matthias Krüger
e8134a3380
Rollup merge of #137641 - kpreid:dealloc, r=Amanieu
More precisely document `Global::deallocate()`'s safety.

There is a subtlety which "other conditions must be upheld by the caller" does not capture: `GlobalAlloc`/`alloc::dealloc()` require that the provided layout will be *equal*, not just that it "fits", the layout used to allocate. This is always true here due to how `allocate()`, `grow()`, and `shrink()` are implemented (they never return a larger allocation than requested), but that is a non-local property of the implementation, so it should be documented explicitly.

r? libs

`@rustbot` label A-allocators
2025-03-02 22:44:24 +01:00
Matthias Krüger
f47c7e8564
Rollup merge of #137375 - steffahn:clarify-read_line-comment, r=Mark-Simulacrum
Minor internal comments fix for `BufRead::read_line`

Just a little fix that came up while I was reading through this source code, and had to search for a few minutes to find out what was actually *meant* here.
2025-03-02 22:44:23 +01:00
Trevor Gross
c51b229140 Disable f16 on Aarch64 without neon
LLVM has crashes at some `half` operations when built with assertions
enabled if fp-armv8 is not available [1]. Things seem to usually work,
but we are reaching LLVM undefined behavior so this needs to be
disabled.

[1]: https://github.com/llvm/llvm-project/issues/129394
2025-03-01 23:10:21 +00:00
Peter Jaszkowiak
596c14ade4 fix RangeBounds::is_empty documentation
One-sided ranges are never empty
2025-03-01 14:38:07 -07:00
Matthias Krüger
c112b70f12
Rollup merge of #137828 - folkertdev:simd-intrinsic-doc-fixes, r=workingjubilee
Fix inaccurate `std::intrinsics::simd` documentation

This addresses two issues:

- the docs on comparison operators (`simd_gt` etc.) said they only work for floating-point vectors, but they work for integer vectors too.
- the docs on various functions that use a mask did not document that the mask must be a signed integer vector. Unsigned integer vectors would cause invalid behavior when the mask vector is widened (unsigned integers would use zero extension, producing incorrect results).

r? ``@workingjubilee``
2025-03-01 16:03:19 +01:00
Matthias Krüger
bc89ab19c3
Rollup merge of #137809 - Noratrieb:io-error-casing, r=thomcc
Use correct error message casing for `io::const_error`s

Error messages are supposed to start with lowercase letters, but a lot of `io::const_error` messages did not. This fixes them to start with a lowercase letter.
I did consider adding a const check for this to the macro, but some of them start with proper nouns that make sense to uppercase them.

See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-03-01 16:03:13 +01:00
Matthias Krüger
c1b4454275
Rollup merge of #137730 - RalfJung:checked_ilog_tests, r=tgross35
checked_ilog tests: deal with a bit of float imprecision

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

r? `@tgross35`
2025-03-01 05:49:54 +01:00
Folkert de Vries
854e9f4803
intrinsics::simd: document that masks must be signed integer vectors
this is because they may be widened, and that only works when sign extension is used: zero extension would produce invalid results
2025-03-01 00:28:47 +01:00
Folkert de Vries
45492662c7
correct the docs on simd_ comparison operators
these all also accept integer vectors as arguments
2025-03-01 00:18:54 +01:00
Noratrieb
cdef38812d Use correct error message casing for io::const_errors
Error messages are supposed to start with lowercase letters, but a lot
of `io::const_error` messages did not. This fixes them to start with a
lowercase letter.
I did consider adding a const check for this to the macro, but some of
them start with proper nouns that make sense to uppercase them.

See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-02-28 17:50:38 +01:00
许杰友 Jieyou Xu (Joe)
4606610b21
Rollup merge of #137673 - ChrisDenton:search-path-bug, r=dtolnay
Fix Windows `Command` search path bug

Currently `Command::new` on Windows works differently depending on whether any environment variable is set. For example,

```rust
// Searches for "myapp" in the application and system paths first (aka Windows native behaviour).
Command::new("myapp").spawn();

// Search for "myapp" in `PATH` first
Command::new("myapp").env("a", "b").spawn();
```

This is a bug because the search path should only change if `PATH` is changed for the child (i.e. `.env("PATH", "...")`).

This was discussed in a libs-api meeting where the exact semantics of `Command::new` was not decided but there seemed to be broad agreement that this particular thing is just a bug that can be fixed.

r? libs-api
2025-02-28 22:29:53 +08:00
许杰友 Jieyou Xu (Joe)
50ef985be2
Rollup merge of #137551 - folkertdev:import-simd-intrinsics, r=RalfJung
import `simd_` intrinsics

In most cases, we can import the simd intrinsics rather than redeclare them. Apparently, most of these tests were written before `std::intrinsics::simd` existed.

There are a couple of exceptions where we can't yet import:

- the intrinsics are not declared as `const fn` in the standard library, causing issues in the `const-eval` tests
- the `simd_shuffle_generic` function is not exposed from `std::intrinsics`
- the `simd_fpow` and `simd_fpowi` functions are not exposed from `std::intrinsics` (removed in https://github.com/rust-lang/rust/pull/137595)
- some tests use `no_core`, and therefore cannot use `std::intrinsics`

r? ```@RalfJung```

cc ```@workingjubilee``` do you have context on why some intrinsics are not exposed?
2025-02-28 22:29:51 +08:00
许杰友 Jieyou Xu (Joe)
87cac9fdb5
Rollup merge of #137197 - scottmcm:cmp-20, r=ibraheemdev
Update some comparison codegen tests now that they pass in LLVM20

Fixes #106107

Needed one tweak to the default `PartialOrd::le` to get the test to pass.  Everything but the derived 2-field `le` test passes even without the change to the defaults in the trait.
2025-02-28 22:29:50 +08:00
Ralf Jung
31388f5280 checked_ilog tests: deal with a bit of float imprecision 2025-02-27 15:38:22 +01:00
Folkert de Vries
4e961dc015
make simd_insert and simd_extract const fns 2025-02-27 12:23:00 +01:00
Matthias Krüger
f19d4b5f97
Rollup merge of #137480 - fuzzypixelz:fix/124466, r=workingjubilee
Return unexpected termination error instead of panicing in `Thread::join`

There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes #124466.
2025-02-27 08:56:39 +01:00
Matthias Krüger
3499846073
Rollup merge of #137304 - pitaj:rangebounds-is_empty-intersect, r=ibraheemdev
add `IntoBounds::intersect` and `RangeBounds::is_empty`

- ACP: https://github.com/rust-lang/libs-team/issues/539
- Tracking issue for `is_empty`: #137300
- Tracking issue for `IntoBounds`: #136903
2025-02-27 08:56:38 +01:00
Deadbeef
ef66cbb27b require trait impls to have matching const stabilities as the traits 2025-02-27 04:56:27 +00:00
León Orell Valerian Liehr
c5d57274c0
Rollup merge of #137620 - SergioGasquez:fix/espidf-maybeunit, r=ChrisDenton
Fix `attr` cast for espidf

https://github.com/rust-lang/rust/pull/136826 broke ESP-IDF builds with: https://github.com/esp-rs/esp-idf-template/actions/runs/13516221587/job/37765336588.

This PR fixes it.

cc: ``@ivmarkov`` ``@xizheyin``
2025-02-26 19:03:55 +01:00
León Orell Valerian Liehr
f3a445bf75
Rollup merge of #136187 - hkBst:patch-27, r=workingjubilee
Use less CString in the examples of CStr.

Fixes #83999
2025-02-26 19:03:54 +01:00
León Orell Valerian Liehr
bcfff3d40a
Rollup merge of #134585 - cyrgani:uninit_array, r=Amanieu
remove `MaybeUninit::uninit_array`

Closes #134584.
Closes #66845.
The future of this unstable method was described in https://github.com/rust-lang/rust/pull/125082#issuecomment-2161242816. Since `inline_const` was stabilized in 1.79 (4 stable releases away) and no one expressed interest for keeping it in https://github.com/rust-lang/rust/issues/96097, I think it can be removed now as it is not a stable method.
2025-02-26 19:03:53 +01:00
Chris Denton
4fcebee60a
Fix Windows Command search path bug 2025-02-26 13:56:47 +00:00
León Orell Valerian Liehr
0d4af0861e
Rollup merge of #137614 - xizheyin:issue-134874, r=cuviper
fix doc in library/core/src/pin.rs

Fixes #134874
2025-02-26 04:15:08 +01:00
León Orell Valerian Liehr
49249eae11
Rollup merge of #137311 - martn3:enable-f16-mips, r=tgross35
Enable `f16` for MIPS

Blocked on https://github.com/rust-lang/compiler-builtins/pull/762

It seems as if `f16` works on MIPS now according to my testing on Rust master with LLVM 20, and I was asked [here](https://github.com/rust-lang/rust/pull/137167#issuecomment-2669387820) to create PRs with my changes.

I only tested on the flavour of `mipsel-unknown-linux-gnu` hardware that happens to be available to me, so I can't say anything about other MIPS hardware, but from a casual skimming of the LLVM code ([1], [2]) it seems like `f16` should work on all MIPS hardware. So enable it for all MIPS hardware.

[1]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/Target/Mips/MipsISelLowering.h#L370
[2]: https://github.com/rust-lang/llvm-project/blob/rustc/20.1-2025-02-13/llvm/lib/CodeGen/TargetLoweringBase.cpp#L1367-L1388

`@rustbot` label +O-MIPS +F-f16_and_f128 +S-blocked

Tracking issue for f16: https://github.com/rust-lang/rust/issues/116909

r? `@tgross35`
2025-02-26 04:15:03 +01:00
León Orell Valerian Liehr
e121dcffbe
Rollup merge of #137154 - thaliaarchi:wtf8-fast-paths, r=ChrisDenton
Add UTF-8 validation fast paths in `Wtf8Buf`

This adds two more fast paths for UTF-8 validation in `Wtf8Buf`, making use of the `is_known_utf8` flag added in https://github.com/rust-lang/rust/pull/96869 (Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8).

r? `@ChrisDenton`
2025-02-26 04:15:02 +01:00
bors
cb06d12710 Auto merge of #137594 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`

try-job: x86_64-gnu-aux
2025-02-25 22:59:40 +00:00
Kevin Reid
33ee398fda More precisely document Global::deallocate()'s safety.
There is a subtlety which "other conditions must be upheld by the caller"
does not capture: `GlobalAlloc`/`alloc::dealloc()` require that the
provided layout will be *equal*, not just that it "fits", the layout
used to allocate. This is always true here due to how `allocate()`,
`grow()`, and `shrink()` are implemented (they never return a larger
allocation than requested), but that is a non-local property of the
implementation, so it should be documented explicitly.
2025-02-25 13:07:52 -08:00
bors
85abb27636 Auto merge of #137608 - fmease:rollup-h4siso6, r=fmease
Rollup of 8 pull requests

Successful merges:

 - #137370 (adjust_abi: make fallback logic for ABIs a bit easier to read)
 - #137444 (Improve behavior of `IF_LET_RESCOPE` around temporaries and place expressions)
 - #137464 (Fix invalid suggestion from type error for derive macro)
 - #137539 ( Add rustdoc-gui regression test for #137082 )
 - #137576 (Don't doc-comment BTreeMap<K, SetValZST, A>)
 - #137595 (remove `simd_fpow` and `simd_fpowi`)
 - #137600 (type_ir: remove redundant part of comment)
 - #137602 (feature: fix typo in attribute description)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-25 19:36:17 +00:00
Sergio Gasquez
622b4fac82 fix: attr cast for espidf 2025-02-25 16:07:05 +01:00
xizheyin
48483adcb4
fix doc in library/core/src/pin.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-25 21:21:00 +08:00
León Orell Valerian Liehr
86fa9f895c
Rollup merge of #137515 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.148

Includes `f16` symbols on MIPS [1], updates for `libm` [2], and reapplies the patch that drops the `public_test_deps!` macro [3].

[1]: https://github.com/rust-lang/compiler-builtins/pull/762
[2]: https://github.com/rust-lang/compiler-builtins/pull/765
[3]: https://github.com/rust-lang/compiler-builtins/pull/766

try-job: aarch64-gnu
try-job: i686-mingw-1
try-job: i686-mingw-2
try-job: test-various
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: x86_64-rust-for-linux
2025-02-25 13:32:55 +01:00
Mahmoud Mazouz
7058f62d0a
Use .expect(..) instead 2025-02-25 13:11:03 +01:00
León Orell Valerian Liehr
c8741c60cd
Rollup merge of #137576 - goffrie:setvalzst, r=lcnr
Don't doc-comment BTreeMap<K, SetValZST, A>

This otherwise shows up in documentation as an empty impl block (worse, at the *top* of the docs above the public impls).
2025-02-25 13:07:38 +01:00
Ralf Jung
5e4c582b3e disable a potentially bogus test on Miri 2025-02-25 09:35:28 +01:00
bors
ad27045c31 Auto merge of #137571 - tgross35:rollup-i1tcnv1, r=tgross35
Rollup of 8 pull requests

Successful merges:

 - #134655 (Stabilize `hash_extract_if`)
 - #135933 (Explain how Vec::with_capacity is faithful)
 - #136668 (Stabilize `core::str::from_utf8_mut` as `const`)
 - #136775 (Update `String::from_raw_parts` safety requirements)
 - #137109 (stabilize extract_if)
 - #137349 (Implement `read_buf` for zkVM stdin)
 - #137493 (configure.py: don't instruct user to run nonexistent program)
 - #137516 (remove some unnecessary rustc_const_unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-25 05:41:34 +00:00
Geoffry Song
7a60c49c64
Don't doc-comment BTreeMap<K, SetValZST, A> 2025-02-24 18:24:22 -08:00
Michael Goulet
74e5366020
Rollup merge of #137543 - petrochenkov:wintest, r=ChrisDenton
std: Fix another new symlink test on Windows

Checking for `got_symlink_permission` first is a standard procedure for such tests.
2025-02-24 19:21:48 -05:00
Michael Goulet
8f729e9cff
Rollup merge of #137489 - RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk
remove `#[rustc_intrinsic_must_be_overridde]`

In https://github.com/rust-lang/rust/pull/135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it.

r? `@oli-obk`

There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
2025-02-24 19:21:47 -05:00
Michael Goulet
1cd083d73f
Rollup merge of #137321 - aviraxp:patch-1, r=cuviper
Correct doc about `temp_dir()` behavior on Android

Since commit d5ccb038f6, `TMPDIR` will be set to application's cache dir when app starts.
2025-02-24 19:21:46 -05:00
Trevor Gross
91dc3eed50
Rollup merge of #137516 - RalfJung:rustc_const_unstable-cleanup, r=Amanieu
remove some unnecessary rustc_const_unstable

If the function is anyway unstable, it doesn't need to be `rustc_const_unstable`.

`copy_from_slice` turns out to not do anything const-unstable itself, we just haven't stably committed to it being available in const yet. See [here](https://rustc-dev-guide.rust-lang.org/stability.html?highlight=rustc_const_stable_indirect) for more details on the `rustc_const_stable_indirect` attribute.
2025-02-24 18:46:37 -05:00
Trevor Gross
50940109cc
Rollup merge of #137349 - thaliaarchi:io-optional-methods/zkvm, r=Noratrieb
Implement `read_buf` for zkVM stdin

For the zkVM, even when a guest buffer is uninitialized, from the host's perspective it is just a normal piece of memory which was initialized before letting the guest write into it. This makes `sys_read` safe to use with an uninitialized buffer. See https://github.com/risc0/risc0/issues/2853.

cc `@bobbobbio,` `@flaub`

r? `@Noratrieb`

Tracked in https://github.com/rust-lang/rust/issues/136756
2025-02-24 18:46:36 -05:00
Trevor Gross
57ce16ca27
Rollup merge of #137109 - bend-n:knife, r=oli-obk
stabilize extract_if

Tracking issue: #43244
Closes: #43244
FCP completed: https://github.com/rust-lang/rust/issues/43244#issuecomment-2523595704
2025-02-24 18:46:35 -05:00
Trevor Gross
03326daf23
Rollup merge of #136775 - robertbastian:patch-2, r=Amanieu
Update `String::from_raw_parts` safety requirements

These have become out of sync with `Vec::from_raw_part`'s safety requirements, and are likely to diverge again. I think it's safest to just point at `Vec`'s requirements.

https://github.com/rust-lang/rust/issues/119206#issuecomment-2180116680
2025-02-24 18:46:35 -05:00
Trevor Gross
fe2876fcba
Rollup merge of #136668 - WaffleLapkin:from_utf8_mut, r=Amanieu
Stabilize `core::str::from_utf8_mut` as `const`

cc #91006 (tracking issue)

r? libs-api
2025-02-24 18:46:34 -05:00
Trevor Gross
dc2b86feb8
Rollup merge of #135933 - hkBst:patch-19, r=workingjubilee
Explain how Vec::with_capacity is faithful

This is a revival of https://github.com/rust-lang/rust/pull/99790 building on the prose of `@workingjubilee` and edits of `@jmaargh.` Closes https://github.com/rust-lang/rust/issues/99385.
2025-02-24 18:46:34 -05:00
Trevor Gross
23e113200d
Rollup merge of #134655 - GrigorenkoPV:hash_extract_if, r=cuviper
Stabilize `hash_extract_if`

FCP complete: https://github.com/rust-lang/rust/issues/59618#issuecomment-2674880530

Tracking issue: #59618
Closes #59618
2025-02-24 18:46:33 -05:00
Michael Goulet
5c5ed92c37 Simplify trait error message for CoercePointee validation 2025-02-24 19:34:54 +00:00
Vadim Petrochenkov
9c65672397 std: Fix another new symlink test on Windows 2025-02-24 17:12:37 +03:00