Commit Graph

24632 Commits

Author SHA1 Message Date
Amanieu d'Antras
9b7d31c851 Merge pull request #1862 from folkertdev/combine-c-files
`intrinsic-test`: combine C files for faster compilation
2025-07-18 21:23:35 +00:00
Amanieu d'Antras
8fe55684d8 Merge pull request #1860 from folkertdev/stdarch-test-cleanup
`stdarch-test`: various cleanups
2025-07-18 20:27:56 +00:00
Marijn Schouten
c79f62d1ea clippy fix: bound in one place 2025-07-18 20:13:24 +00:00
The rustc-josh-sync Cronjob Bot
3f04631ce0 Merge ref '82310651b93a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 82310651b9
Filtered ref: e13c0be8f13737c64082b89ce834546079767ac4

This merge was created using https://github.com/rust-lang/josh-sync.
2025-07-18 19:06:49 +00:00
The rustc-josh-sync Cronjob Bot
208687e9d3 Prepare for merging from rust-lang/rust
This updates the rust-version file to 82310651b9.
2025-07-18 19:04:50 +00:00
Julien THILLARD
6b87978169 Change the memcmp and bcmp return type to c_int
Fix the return type of `memcmp` and `bcmp` builtin functions on targets
with a `c_int` other than `i32`.

Linked issue: https://github.com/rust-lang/rust/issues/144076
2025-07-18 18:19:13 +00:00
Trevor Gross
7dacaef5d3 mem: Use core::ffi::c_int
This alias was added in 9897bfb8a ("Fix memset arguments for MSP430
target"), which predates `core::ffi`. Now that it exists we can just use
`core::ffi::c_int`.
2025-07-18 17:35:57 +00:00
Matthias Krüger
401aaf4ac1 Rollup merge of #143382 - fee1-dead-contrib:push-trrymlzqmmoz, r=jhpratt
stabilize `const_slice_reverse`

cc rust-lang/rust#135120, needs FCP.
2025-07-18 19:14:44 +02:00
Luigi Sartor Piucco
8a8717e971 fix: don't panic on volatile access to null
According to
https://discourse.llvm.org/t/rfc-volatile-access-to-non-dereferenceable-memory-may-be-well-defined/86303/4,
LLVM allows volatile operations on null and handles it correctly. This
should be allowed in Rust as well, because I/O memory may be hard-coded
to address 0 in some cases, like the AVR chip ATtiny1626.

A test case that ensured a failure when passing null to volatile was
removed, since it's now valid.

Due to the addition of `maybe_is_aligned` to `ub_checks`,
`maybe_is_aligned_and_not_null` was refactored to use it.

docs: revise restrictions on volatile operations

A distinction between usage on Rust memory vs. non-Rust memory was
introduced. Documentation was reworded to explain what that means, and
make explicit that:

- No trapping can occur from volatile operations;
- On Rust memory, all safety rules must be respected;
- On Rust memory, the primary difference from regular access is that
  volatile always involves a memory dereference;
- On Rust memory, the only data affected by an operation is the one
  pointed to in the argument(s) of the function;
- On Rust memory, provenance follows the same rules as non-volatile
  access;
- On non-Rust memory, any address known to not contain Rust memory is
  valid (including 0 and usize::MAX);
- On non-Rust memory, no Rust memory may be affected (it is implicit
  that any other non-Rust memory may be affected, though, even if not
  referenced by the pointer). This should be relevant when, for example,
  reading register A causes a flag to change in register B, or writing
  to A causes B to change in some way. Everything affected mustn't be
  inside an allocation.
- On non-Rust memory, provenance is irrelevant and a pointer with none
  can be used in a valid way.

fix: don't lint null as UB for volatile

Also remove a now-unneeded `allow` line.

fix: additional wording nits
2025-07-18 13:41:34 -03:00
Folkert de Vries
d198c4fbf5 Merge pull request #1874 from heiher/loong-safe
loongarch: Mark partial intrinsics as safe
2025-07-18 13:15:24 +00:00
Matthias Krüger
82fbbddf63 Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-dead
Make slice comparisons const

This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable.

r? ```@fee1-dead```

cc rust-lang/rust#143800
2025-07-18 14:49:19 +02:00
Matthias Krüger
744ca5959a Rollup merge of #143909 - nik-rev:patch-1, r=jhpratt
docs(alloc::fmt): Make type optional, instead of matching empty string

Think this is clearer.

Noticed as I was implementing [`tree-sitter-rust-format-args`](https://github.com/nik-rev/tree-sitter-rust-format-args), and attempting to match the empty string results in an error.
2025-07-18 14:49:19 +02:00
WANG Rui
da892b54be loongarch: Mark SIMD intrinsics without memory access as safe 2025-07-18 20:42:19 +08:00
Folkert de Vries
846c591bf6 intrinsic-test: combine C files for more efficient compilation 2025-07-18 13:24:11 +02:00
Folkert de Vries
6ed7ee36e6 exclude generated rust programs from the workspace 2025-07-18 13:17:38 +02:00
Folkert de Vries
a657eb29e2 Merge pull request #1878 from madhav-madhusoodanan/intrinsic-test-box-removing-and-more
`intrinsic-test`: Implemented DerefMut for ArmIntrinsicTest
2025-07-18 10:20:35 +00:00
Folkert de Vries
2b6d8f36c8 Merge pull request #1861 from folkertdev/streamline-c-compilation
`intrinsic-test`: streamline c compilation
2025-07-18 10:12:22 +00:00
Folkert de Vries
76de7566e4 Merge pull request #1877 from folkertdev/check-stdarch-gen
Check that the checked-in version of `stdarch-gen-{arm, loongarch}` is up-to-date
2025-07-18 09:48:49 +00:00
Folkert de Vries
75887cf995 improve cpp compiler execution 2025-07-18 11:38:18 +02:00
Folkert de Vries
668fdbe41e pass the whole config to C compiler construction 2025-07-18 11:25:11 +02:00
Folkert de Vries
194aa89fdd add CI action to check that generated files are correctly checked in 2025-07-18 11:13:59 +02:00
WANG Rui
b57ff35641 loongarch: Mark partial basic intrinsics as safe 2025-07-18 11:52:17 +08:00
Matthias Krüger
a7009e93e6 Rollup merge of #143967 - oli-obk:const-option-methods, r=fee1-dead
constify `Option` methods

r? ```````@fee1-dead```````

tracking issue: rust-lang/rust#143956

these unblock making `PartialOrd` and `Ord` const without resorting to inlining some of these at call sites.
2025-07-18 04:27:53 +02:00
Oli Scherer
68b415a0c4 Make slices [const] PartialEq 2025-07-17 17:58:10 +00:00
Oli Scherer
250648e871 Make derive_const usable within libcore again
Also make it *only* usable on nightly
2025-07-17 15:42:54 +00:00
Oli Scherer
9d29583355 Make NonZero const PartialEq 2025-07-17 15:42:54 +00:00
Oli Scherer
2f5722cf1b Make Option const PartialEq 2025-07-17 15:42:54 +00:00
Jakub Beránek
d963c78140 Update the no-merges PR title
Match the new CI-created PRs:
https://github.com/rust-lang/compiler-builtins/pull/974.
2025-07-17 10:30:52 +00:00
Oli Scherer
853333d4bd constify Option methods 2025-07-17 09:11:05 +00:00
Trevor Gross
5157aa1a0f Allow a new lint failure in nightly
```text
warning: function `f32_to_bits` is never used
   --> libm/src/math/support/float_traits.rs:367:14
    |
367 | pub const fn f32_to_bits(x: f32) -> u32 {
    |              ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: function `f64_to_bits` is never used
   --> libm/src/math/support/float_traits.rs:381:14
    |
381 | pub const fn f64_to_bits(x: f64) -> u64 {
    |              ^^^^^^^^^^^

warning: `libm` (lib) generated 2 warnings
```

This is a false positive, see RUST-144060.
2025-07-17 03:59:25 -05:00
Matthias Krüger
465ae94328 Rollup merge of #143631 - hkBst:update-escaper-2, r=compiler-errors
update to literal-escaper-0.0.5

Quoting from the changelog, this version brings:
- Use `NonZero<char/u8>` in `unescape_c_str` and `check_raw_c_str` to statically exclude nuls
- Add `#[inline]` to small functions for improved performance
2025-07-17 10:41:45 +02:00
Matthias Krüger
08fa97173e Rollup merge of #143326 - hkBst:rm-deprecated-1, r=jhpratt
Remove deprecated `Error::description` impl from `c_str::FromBytesWithNulError`
2025-07-17 10:41:43 +02:00
León Orell Valerian Liehr
7e041c46f7 Rollup merge of #144002 - martinomburajr:patch-1, r=ibraheemdev
Update poison.rs

Typo in word "below" previously "bellow"
2025-07-17 03:58:35 +02:00
León Orell Valerian Liehr
36a362bff5 Rollup merge of #143856 - mladedav:dm/private-reexport, r=petrochenkov
Linting public reexport of private dependencies

Part of public/private dependencies rust-lang/rust#44663
Partially addresses rust-lang/rust#71043

I'm adding a warning for reexports of private dependencies into `rustc_resolve`. I get that this should not be a warning, but should instead be a lint to be controlled by the feature gate, but I did not figure out how exactly to do that at that point. I tried doing the same thing as is done in `rustc_privacy`, but the linting system is not ready yet as far as I understand the error I got, so I made a warning for now instead. Some guidance on how to emit lints with `dcx` would be appreciated.

This also sets the `std_detect` crate as a public dependency of `std` because some macros are reexported from there. I did not check closer, but the other option may be to allow the specific reexports instead.
2025-07-17 03:58:33 +02:00
León Orell Valerian Liehr
b9fd2bccfa Rollup merge of #143829 - a1phyr:trim_borrowed_buf, r=ChrisDenton
Trim `BorrowedCursor` API

This PR removes some method from the unstable `BorrowedCursor` type. A rational for each change can be found in the message of each commit.

I don't think that an ACP is required for this, please tell me if it is not the case.

Cc rust-lang/rust#78485 rust-lang/rust#117693
2025-07-17 03:58:32 +02:00
León Orell Valerian Liehr
ac98b4e733 Rollup merge of #143820 - nazo6:fix-optimize-for-size, r=Mark-Simulacrum
Fixed a core crate compilation failure when enabling the `optimize_for_size` feature on some targets

This fixes rust-lang/rust#143804.
2025-07-17 03:58:31 +02:00
León Orell Valerian Liehr
83288db888 Rollup merge of #143595 - fee1-dead-contrib:push-sylpykzkmynr, r=RalfJung,fee1-dead
add `const_make_global`; err for `const_allocate` ptrs if didn't call

Implements as discussed on Zulip: [#t-compiler/const-eval > const heap](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/const.20heap/with/527125421)

r? ```@rust-lang/wg-const-eval```

Fixes https://github.com/rust-lang/rust/issues/129233
2025-07-17 03:58:30 +02:00
León Orell Valerian Liehr
2f879530d2 Rollup merge of #143592 - ChrisDenton:uwp-link, r=Mark-Simulacrum
UWP: link ntdll functions using raw-dylib

Lazy loading isn't necessary so there's no need for the added complexity and overhead. However, it may be that people using UWP rust libraries don't have the necessary import libraries linked by Visual Studio so this uses raw-dylib, which allows linking to DLL functions without having an import library. This is a somewhat temporary situation as raw-dylib is intended to eventually be the default for all imports. When that happens, this special case can be removed.

Closes rust-lang/rust#143530
2025-07-17 03:58:29 +02:00
Folkert de Vries
5438a7c110 stdarch-test: for now, allow if only part of an instruction matched 2025-07-17 02:12:16 +02:00
Folkert de Vries
b74c4825cb test for the high version of a number of instructions 2025-07-17 02:12:15 +02:00
Madhav Madhusoodanan
10d7b7b676 Implemented DerefMut for ArmIntrinsicTest
More details: 1. Moved the return type of IntrinsicType::from_c to
Rust<Self, String> from Result<Box<Self>, String>
2025-07-16 23:49:04 +05:30
Samuel Tardieu
96a9df4cf9 Rollup merge of #143990 - camsteffen:localkey-cell, r=tgross35
Add LocalKey<Cell>::update

Tracking issue: rust-lang/rust#143989
2025-07-16 17:06:44 +02:00
Samuel Tardieu
9eda137008 Rollup merge of #143921 - oli-obk:const-index, r=fee1-dead
Constify `Index` traits

tracking issue: rust-lang/rust#143775

the `SliceIndex` trait cannot be implemented by users as it is sealed. While it would be useful for the `get` method on slices, it seems weird to have a feature gate for that that isn't also gating index syntax at the same time, so I put them under the same feature gate.

r? ```````@fee1-dead```````
2025-07-16 17:06:41 +02:00
Samuel Tardieu
096a66d8d8 Rollup merge of #143738 - rocurley:float_tests_refactor_2, r=tgross35
Move several float tests to floats/mod.rs

This PR moves several tests to `floats/mod.rs`, as discussed in https://github.com/rust-lang/rust/issues/141726. The tests moved are:

- `test_num_f*`
- `test_infinity`
- `test_neg_infinity`
- `test_zero`
- `test_neg_zero`
- `test_one`
- `test_is_nan`
- `test_is_infinite`
- `test_is_finite`
- `test_is_normal`
- `test_classify`

Each test is its own commit, so it may be easiest to review each commit individually.

r? tgross35
2025-07-16 17:06:40 +02:00
Samuel Tardieu
37aba8388e Rollup merge of #143355 - hkBst:cleanup-shift-double-bitmask, r=Mark-Simulacrum
wrapping shift: remove first bitmask and table

```rust
        #[inline(always)]
        pub const fn wrapping_shl(self, rhs: u32) -> Self {
            // SAFETY: the masking by the bitsize of the type ensures that we do not shift
            // out of bounds
            unsafe {
                self.unchecked_shl(rhs & (Self::BITS - 1))
            }
        }
```
already does the bitmask, so it seems unnecessary here.

More context: internals.rust-lang.org/t/wrapping-shift-operator-code-doing-bitmasking-twice/23167
2025-07-16 17:06:38 +02:00
Folkert de Vries
0d9d209417 fix space in generated loongarch 2025-07-16 16:27:51 +02:00
Amanieu d'Antras
f694b583e6 Merge pull request #1875 from sayantn/sde-update
Bump CI versions
2025-07-16 12:23:08 +00:00
sayantn
08ef071717 Update wasmprinter to latest 2025-07-16 17:18:23 +05:30
sayantn
ed2918988b Bump versions in CI
- `clang-19` -> `clang-20` in ARM
 - `gcc-14.2` -> `gcc-14.3` in AArch64-BE
 - `gcc-14` ->`gcc-15` in LA64
 - `riscv-gnu-v2025.01.20` -> `riscv-gnu-v2025.07.03` in Risc-V 32
 - `wasmtime-v18.0.2` -> `wasmtime-v34.0.1`
2025-07-16 17:18:23 +05:30
sayantn
a2486a5138 Update Docker OS to Ubuntu-25.10 2025-07-16 17:18:22 +05:30