Commit Graph

285244 Commits

Author SHA1 Message Date
joboet
ff37c7d395
std: use the address of errno to identify threads in unique_thread_exit
Getting the address of `errno` should be just as cheap as `pthread_self()` and avoids having to use the expensive `Mutex` logic because it always results in a pointer.
2025-04-01 13:35:16 +02:00
bors
45b40a7596 Auto merge of - Kobzol:revert-129827, r=petrochenkov
Revert "Auto merge of  - bvanjoi:less-decoding, r=petrochenkov"

Reverting https://github.com/rust-lang/rust/pull/129827 because of a performance regression.

This reverts commit d4812c8638, reversing changes made to 5cc60728e7.

r? `@petrochenkov`
2025-03-30 11:41:40 +00:00
Jakub Beránek
31face9f60 Revert "Auto merge of - bvanjoi:less-decoding, r=petrochenkov"
Reverting because of a performance regression.

This reverts commit d4812c8638, reversing
changes made to 5cc60728e7.
2025-03-30 11:14:33 +02:00
bors
b9ea82b84a Auto merge of - madsmtm:openwrt-target-vendor, r=jieyouxu
Set `target_vendor = "openwrt"` on `mips64-openwrt-linux-musl`

OpenWRT is a Linux distribution for embedded network devices. The target name contains `openwrt`, so we should set `cfg(target_vendor = "openwrt")`.

This is similar to what other Linux distributions do (the only one in-tree is `x86_64-unikraft-linux-musl`, but that sets `target_vendor = "unikraft"`).

Motivation: To make correctly [parsing target names](https://github.com/rust-lang/cc-rs/pull/1413) simpler.

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

CC target maintainer `@Itus-Shield`
2025-03-30 08:33:29 +00:00
bors
85f518ec8e Auto merge of - taiki-e:riscv-vector, r=Amanieu
rustc_target: Add more RISC-V vector-related features and use zvl*b target features in vector ABI check

Currently, we have only unstable `v` target feature, but RISC-V have more vector-related extensions. The first commit of this PR adds them to unstable `riscv_target_feature`.

- `unaligned-vector-mem`: Has reasonably performant unaligned vector
  - [LLVM definition](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L1379)
  - Similar to currently unstable `unaligned-scalar-mem` target feature, but for vector instructions.
- `zvfh`: Vector Extension for Half-Precision Floating-Point
  - [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zvfh-vector-extension-for-half-precision-floating-point)
  - [LLVM definition](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L668)
  - This implies `zvfhmin` and `zfhmin`
- `zvfhmin`: Vector Extension for Minimal Half-Precision Floating-Point
  - [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zvfhmin-vector-extension-for-minimal-half-precision-floating-point)
  - [LLVM definition](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L662)
  - This implies `zve32f`
- `zve32x`, `zve32f`, `zve64x`, `zve64f`, `zve64d`: Vector Extensions for Embedded Processors
  - [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zve-vector-extensions-for-embedded-processors)
  - [LLVM definitions](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L612-L641)
  - `zve32x` implies `zvl32b`
  - `zve32f` implies `zve32x` and `f`
  - `zve64x` implies `zve32x` and `zvl64b`
  - `zve64f` implies `zve32f` and `zve64x`
  - `zve64d` implies `zve64f` and `d`
  - `v` implies `zve64d`
- `zvl*b`: Minimum Vector Length Standard Extensions
  - [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/v-st-ext.adoc#zvl-minimum-vector-length-standard-extensions)
  - [LLVM definitions](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L600-L610)
  - `zvl{N}b` implies `zvl{N>>1}b`
  - `v` implies `zvl128b`
- Vector Cryptography and Bit-manipulation Extensions
  - [ISA Manual](https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-2336fdc-2025-03-19/src/vector-crypto.adoc)
  - [LLVM definitions](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/llvm/lib/Target/RISCV/RISCVFeatures.td#L679-L807)
  - `zvkb`: Vector Bit-manipulation used in Cryptography
    - This implies `zve32x`
  - `zvbb`: Vector basic bit-manipulation instructions
    - This implies `zvkb`
  - `zvbc`: Vector Carryless Multiplication
    - This implies `zve64x`
  - `zvkg`: Vector GCM instructions for Cryptography
    - This implies `zve32x`
  - `zvkned`: Vector AES Encryption & Decryption (Single Round)
    - This implies `zve32x`
  - `zvknha`: Vector SHA-2 (SHA-256 only))
    - This implies `zve32x`
  - `zvknhb`: Vector SHA-2 (SHA-256 and SHA-512)
    - This implies `zve64x`
    - This is superset of `zvknha`, but doesn't imply that feature at least in LLVM
  - `zvksed`: SM4 Block Cipher Instructions
    - This implies `zve32x`
  - `zvksh`: SM3 Hash Function Instructions
    - This implies `zve32x`
  - `zvkt`: Vector Data-Independent Execution Latency
    - Similar to already stabilized scalar cryptography extension `zkt`.
  - `zvkn`: Shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and 'Zvkt'
    - Similar to already stabilized scalar cryptography extension `zkn`.
  - `zvknc`: Shorthand for 'Zvkn' and 'Zvbc'
  - `zvkng`: shorthand for 'Zvkn' and 'Zvkg'
  - `zvks`: shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and 'Zvkt'
    - Similar to already stabilized scalar cryptography extension `zks`.
  - `zvksc`: shorthand for 'Zvks' and 'Zvbc'
  - `zvksg`: shorthand for 'Zvks' and 'Zvkg'

Also, our vector ABI check wants `zvl*b` target features, the second commit of this PR updates vector ABI check to use them.

4e2b096ed6/compiler/rustc_target/src/target_features.rs (L707-L708)

---

r? `@Amanieu`

`@rustbot` label +O-riscv +A-target-feature
2025-03-30 02:21:56 +00:00
bors
2196affd01 Auto merge of - matthiaskrgr:rollup-7l2ri0f, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 -  (stabilize const_cell)
 -  (Fix `uclibc` LLVM target triples)
 -  (Start using `with_native_path` in `std::sys::fs`)
 -  (std: deduplicate `errno` accesses)
 -  (compiletest: Support matching diagnostics on lines below)
 -  (`BackendRepr::is_signed`: comment why this may panics)
 -  (Mark .pp files as Rust)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-29 23:12:40 +00:00
Matthias Krüger
ed1f776e5c
Rollup merge of - ShE3py:pp-highlighting, r=compiler-errors
Mark .pp files as Rust

Pretty-printing tests generate `.pp` files, but GitHub classify and highlight them as Pascal:
[https://github.com/search?q=repo:rust-lang/rust+path:*.pp&type=code](https://github.com/search?q=repo%3Arust-lang%2Frust+path%3A*.pp&type=code)

``@rustbot`` label +A-meta +A-testsuite
2025-03-29 21:08:14 +01:00
Matthias Krüger
713c58e37d
Rollup merge of - ShE3py:BackendRepr-is_signed, r=compiler-errors
`BackendRepr::is_signed`: comment why this may panics

Was wondering why this method could panics while the others couldn't, so quote PR .
2025-03-29 21:08:14 +01:00
Matthias Krüger
a584cc7c70
Rollup merge of - petrochenkov:errbelow, r=jieyouxu
compiletest: Support matching diagnostics on lines below

Using `//~vvv ERROR`.

This is not needed often, but it's easy to support, and it allows to eliminate a class of `error-pattern`s that cannot be eliminated in any other way.

See the diff for the examples of such patterns coming from parser.
Some of them can be matched by `//~ ERROR` or `//~^ ERROR` as well (when the final newline is allowed), but it changes the shape of reported spans, so I chose to keep the spans by using `//~v ERROR`.
2025-03-29 21:08:13 +01:00
Matthias Krüger
821e0fe0a2
Rollup merge of - joboet:errno_dedup, r=Noratrieb
std: deduplicate `errno` accesses

By marking `__errno_location` as `#[ffi_const]` and `std::sys::os::errno` as `#[inline]`, this PR allows merging multiple calls to `io::Error::last_os_error()` into one.
2025-03-29 21:08:12 +01:00
Matthias Krüger
fb6d10e13b
Rollup merge of - ChrisDenton:with_native_path, r=joboet
Start using `with_native_path` in `std::sys::fs`

Ideally, each platform should use their own native path type internally. This will, for example, allow passing a `CStr` directly to `std::fs::File::open` and therefore avoid the need for allocating a new null-terminated C string.

However, doing that for every function and platform all at once makes for a large PR that is way too prone to breaking. So this PR does some minimal refactoring which should help progress towards that goal. The changes are Unix-only and even then I avoided functions that require more changes so that this PR is just moving things around.

r? joboet
2025-03-29 21:08:12 +01:00
Matthias Krüger
2b0c2f7904
Rollup merge of - madsmtm:uclibc-llvm-target, r=jieyouxu
Fix `uclibc` LLVM target triples

`uclibc` is not an environment understood by LLVM, it is only a concept in Clang that can be selected with `-muclibc` (it affects which dynamic linker is passed to the static linker's `-dynamic-linker` flag).

In fact, using `uclibcgnueabi`/`uclibc` is actively harmful, as it prevents LLVM from seeing that the target is gnu-like; we should use `gnueabi`/`gnu` directly instead.

Motivation: To make it easier to verify that [`cc-rs`' conversion from `rustc` to Clang/LLVM triples](https://github.com/rust-lang/cc-rs/issues/1431) is correct.

**There are no target maintainers for these targets.** So I'll CC ``@lancethepants`` and ``@skrap`` who maintain the related `armv7-unknown-linux-uclibceabi` and `armv7-unknown-linux-uclibceabihf` (both of which already pass `-gnu` instead of `-uclibc`) in case they have any insights.

r? jieyouxu
2025-03-29 21:08:11 +01:00
Matthias Krüger
7ef7034caf
Rollup merge of - RalfJung:const_cell, r=m-ou-se
stabilize const_cell

``@rust-lang/libs-api`` ``@rust-lang/wg-const-eval`` I see no reason to wait any longer, so I propose we stabilize the use of `Cell` in `const fn`  -- specifically the APIs listed here:
```rust
// core::cell

impl<T> Cell<T> {
    pub const fn replace(&self, val: T) -> T;
}

impl<T: Copy> Cell<T> {
    pub const fn get(&self) -> T;
}

impl<T: ?Sized> Cell<T> {
    pub const fn get_mut(&mut self) -> &mut T;
    pub const fn from_mut(t: &mut T) -> &Cell<T>;
}

impl<T> Cell<[T]> {
    pub const fn as_slice_of_cells(&self) -> &[Cell<T>];
}
```
Unfortunately, `set` cannot be made `const fn` yet as it drops the old contents.

Fixes https://github.com/rust-lang/rust/issues/131283
2025-03-29 21:08:10 +01:00
bors
1799887bb2 Auto merge of - frank-king:feature/unique_arc, r=Amanieu
Implement `alloc::sync::UniqueArc`

This implements the `alloc::sync::UniqueArc` part of .
2025-03-29 20:05:06 +00:00
bors
d4812c8638 Auto merge of - bvanjoi:less-decoding, r=petrochenkov
perform less decoding if it has the same syntax context

Following this [comment](https://github.com/rust-lang/rust/pull/127279#issuecomment-2210376603)

r? `@petrochenkov`
2025-03-29 16:50:04 +00:00
Chris Denton
89c9c21b06
Start using with_native_path in std::sys::fs 2025-03-29 14:43:41 +00:00
bors
5cc60728e7 Auto merge of - matthiaskrgr:rollup-zhu7hf6, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 -  (Reject `{true,false}` as revision names)
 -  (wasm: increase default thread stack size to 1 MB)
 -  (Change the syntax of the internal `weak!` macro)
 -  (use `try_fold` instead of `fold`)
 -  (use `slice::contains` where applicable)
 -  (Various cleanup in ExprUseVisitor)
 -  (Add more tests for pin!().)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-29 13:41:27 +00:00
Lieselotte
daeb449640
Mark .pp files as Rust 2025-03-29 12:39:06 +01:00
Lieselotte
439048e074
BackendRepr::is_signed: comment why this may panics 2025-03-29 12:21:51 +01:00
Matthias Krüger
8b7088ab5f
Rollup merge of - m-ou-se:pin-tests, r=WaffleLapkin
Add more tests for pin!().

This adds the tests suggested by `@danielhenrymantilla` in this comment: https://github.com/rust-lang/rust/pull/138717#discussion_r2005433640 by
2025-03-29 11:43:49 +01:00
Matthias Krüger
12165fce87
Rollup merge of - meithecatte:expr-use-visitor-cleanup, r=compiler-errors
Various cleanup in ExprUseVisitor

These are the non-behavior-changing commits from .
2025-03-29 11:43:49 +01:00
Matthias Krüger
b5ad69bb93
Rollup merge of - yotamofek:pr/slice-contains, r=wesleywiser
use `slice::contains` where applicable

Applies the [`manual_contains`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains) clippy lint, plus some small drive-bys.
2025-03-29 11:43:48 +01:00
Matthias Krüger
0e722cce62
Rollup merge of - yotamofek:pr/smir/try_fold, r=scottmcm
use `try_fold` instead of `fold`

Small cleanup, applies the [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold) clippy lint.
2025-03-29 11:43:47 +01:00
Matthias Krüger
111351fcc1
Rollup merge of - madsmtm:internal-weak-macro-syntax, r=ibraheemdev
Change the syntax of the internal `weak!` macro

Change the syntax to include parameter names and a trailing semicolon.

Motivation:
- Mirror the `syscall!` macro.
- Allow rustfmt to format it (when wrapped in parentheses, and when not inside `cfg_if!`).
- For better documentation (having the parameter names available in the source code is a bit nicer).
- Allow a future improvement to this macro where we can sometimes use the symbol directly when it's statically known to be available (and thus need the parameter names to be available), see https://github.com/rust-lang/rust/pull/136868.

r? libs
2025-03-29 11:43:46 +01:00
Matthias Krüger
c82b88b009
Rollup merge of - rust-wasi-web:wasi-thread-stack-size, r=alexcrichton
wasm: increase default thread stack size to 1 MB

The default stack size for the [main thread is 1 MB as specified by linker options](38cf49dde8/compiler/rustc_target/src/spec/base/wasm.rs (L14)).
However, the default stack size for threads was only 64 kB.

This is surprisingly small and thus we increase it to 1 MB to match the main thread.
2025-03-29 11:43:46 +01:00
Matthias Krüger
240a4da396
Rollup merge of - jieyouxu:reject-bool-lit-rev-names, r=wesleywiser
Reject `{true,false}` as revision names

Because they would imply `--cfg={true,false}` otherwise, and the test writer has to use `cfg(r#true)` and `cfg(r#false)` in the test.

Closes .
2025-03-29 11:43:45 +01:00
bors
898916595c Auto merge of - m-ou-se:terminating-scopes-no-hashset, r=wesleywiser
Remove `terminating_scopes` hash set.

Instead of inserting and checking ids in a hashset, we can just pass a boolean as argument.

For example:

```diff
-    visitor.terminating_scopes.insert(arm.hir_id.local_id);
-    visitor.enter_node_scope_with_dtor(arm.hir_id.local_id);
+    visitor.enter_node_scope_with_dtor(arm.hir_id.local_id, true);
```
2025-03-29 10:31:47 +00:00
Vadim Petrochenkov
cf451f0830 compiletest: Support matching diagnostics on lines below 2025-03-29 13:30:20 +03:00
bohan
366095d6c7 less decoding if it has the same syntax context 2025-03-29 17:44:12 +08:00
Mara Bos
163ea4acd0 Add more tests for pin!().
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2025-03-29 08:10:15 +01:00
bors
928468c47c Auto merge of - BoxyUwU:bump_1_88, r=BoxyUwU
Bump to 1.88

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

r? ghost
2025-03-29 05:42:07 +00:00
Frank King
5004e10ceb Add a test for Weak created from UniqueArc::downgrade 2025-03-29 12:13:38 +08:00
bors
2848101ed5 Auto merge of - madsmtm:bootstrap-bump-cc-cmake, r=jieyouxu
Bump boostrap `cc` to 1.2.17 and `cmake` to 0.1.54

The `cc` version in `bootstrap` was reverted down to 1.1.22 in https://github.com/rust-lang/rust/pull/137460 (previously at 1.2.0). The offending issue has since then been resolved in https://github.com/rust-lang/cc-rs/pull/1413, and a new version of `cc` has been released in https://github.com/rust-lang/cc-rs/pull/1435, so let's try to update the version again.

See [the `cc-rs` changelog](d9dd20e376/CHANGELOG.md) and [the `cmake-rs` changelog](fd56c5a6b4/CHANGELOG.md) for details on what has changed here.

r? jieyouxu who tried this last in https://github.com/rust-lang/rust/pull/137022.
`@rustbot` label T-bootstrap
try-job: *apple*
2025-03-29 00:03:11 +00:00
Mara Bos
122d7e1dcd Remove terminating_scopes hash set. 2025-03-28 22:49:27 +01:00
bors
920d95eaf2 Auto merge of - matthiaskrgr:rollup-3q2peol, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 -  (Explain one-past-the-end pointer in std library)
 -  (Put pin!() tests in the right file.)
 -  (Fix formatting nit in process.rs)
 -  (Fix TAIT & ATPIT feature gating in the presence of anon consts)
 -  (Miri subtree update)
 -  (`io::Take`: avoid new `BorrowedBuf` creation in some case)
 -  (Do not treat lifetimes from parent items as influencing child items)
 -  (tracking autodiff files via triagebot.toml)

Failed merges:

 -  (bootstrap: Avoid cloning `change-id` list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-28 20:56:37 +00:00
Matthias Krüger
20f2655258
Rollup merge of - EnzymeAD:autodfff-triagebot, r=Noratrieb
tracking autodiff files via triagebot.toml

r? `@oli-obk`

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-03-28 21:18:32 +01:00
Matthias Krüger
3e968c7e9f
Rollup merge of - oli-obk:resolver-item-lifetime, r=compiler-errors
Do not treat lifetimes from parent items as influencing child items

```rust
struct A;
impl Bar<'static> for A {
    const STATIC: &str = "";
    //            ^ no future incompat warning
}
```

has no future incompat warning, because there is no ambiguity. But

```rust
struct C;
impl Bar<'_> for C {
//       ^^ this lifeimte
    const STATIC: &'static str = {
        struct B;
        impl Bar<'static> for B {
            const STATIC: &str = "";
            // causes     ^ to emit a future incompat warning
        }
        ""
    };
}
```

had one before this PR, because the impl for `B` (which is just a copy of `A`) thought it was influenced by a lifetime on the impl for `C`.

I double checked all other `lifetime_ribs` iterations and all of them do check for `Item` boundaries. This feels very fragile tho, and ~~I think we should do not even be able to see ribs from parent items, but that's a different refactoring that I'd rather not do at the same time as a bugfix~~. EDIT: ah nevermind, this is needed for improving diagnostics like "use of undeclared lifetime" being "can't use generic parameters from outer item" instead.

r? `@compiler-errors`
2025-03-28 21:18:32 +01:00
Matthias Krüger
7c0a14f030
Rollup merge of - a1phyr:better_take, r=joboet
`io::Take`: avoid new `BorrowedBuf` creation in some case

If `self.limit == buf.capacity()`, doing the whole `BorrowedBuf` dance is not necessary.
2025-03-28 21:18:31 +01:00
Matthias Krüger
b6699318fa
Rollup merge of - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-03-28 21:18:30 +01:00
Matthias Krüger
52aed95060
Rollup merge of - fmease:fix-tait-atpit-gating, r=oli-obk
Fix TAIT & ATPIT feature gating in the presence of anon consts

Fixes  (https://github.com/rust-lang/rust/issues/119924#issuecomment-1928659690).

r? oli-obk or anybody else
2025-03-28 21:18:30 +01:00
Matthias Krüger
660e8633f3
Rollup merge of - barafael:patch-1, r=joboet
Fix formatting nit in process.rs

Minor formatting issue in `process.rs`.
2025-03-28 21:18:29 +01:00
Matthias Krüger
3060c77815
Rollup merge of - m-ou-se:pin-macro-tests, r=joboet
Put pin!() tests in the right file.

In , these tests were put in `tests/pin.rs`, but they should go in `tests/pin_macro.rs`.

r? `@jdonszelmann`
2025-03-28 21:18:28 +01:00
Matthias Krüger
e82557e9ad
Rollup merge of - xizheyin:issue-138969, r=RalfJung
Explain one-past-the-end pointer in std library

Closing 

r? libs
2025-03-28 21:18:27 +01:00
joboet
dd4f616423
std: deduplicate errno accesses
By marking `__errno_location` as `#[ffi_const]` and `std::sys::os::errno` as `#[inline]`, this PR allows merging multiple calls to `io::Error::last_os_error()` into one.
2025-03-28 19:32:36 +01:00
Manuel Drehwald
e6a2c29bc4 tracking autodiff files via triagebot.toml 2025-03-28 14:15:08 -04:00
León Orell Valerian Liehr
7a295d1be0
Fix TAIT & ATPIT feature gating in the presence of anon consts 2025-03-28 18:15:23 +01:00
Oli Scherer
dabee5d563 Do not treat lifetimes from parent items as influencing child items 2025-03-28 17:06:00 +00:00
Boxy
9300fa19b7 Bump to 1.88.0 2025-03-28 16:53:17 +00:00
bors
19f42cb9bb Auto merge of - matthiaskrgr:rollup-2bk2fb4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 -  (update outdated doc with new example)
 -  (Greatly simplify doctest parsing and information extraction)
 -  (rustc_resolve: fix instability in lib.rmeta contents)
 -  (feat(config): Add ChangeId enum for suppressing warnings)
 -  (Update target maintainers for thumb targets to reflect new REWG Arm team name)
 -  (bootstrap: update `test_find` test)
 -  (Remove ScopeDepth)

Failed merges:

 -  (bootstrap: Avoid cloning `change-id` list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-28 16:37:12 +00:00
Benoît du Garreau
9055765ce1 io::Take: avoid new BorrowedBuf creation in some case 2025-03-28 16:36:49 +01:00