Commit Graph

28740 Commits

Author SHA1 Message Date
Matthias Krüger ac7ba99209 Rollup merge of #156403 - SpriteOvO:type-info-refactor-variant, r=oli-obk
Add `TypeId` methods `variants` `fields` `field` for `type_info`

Tracking issue rust-lang/rust#146922

- Adds `fn TypeId::variants` returns the number of variants, for struct and union and primitive types, it's always 1.
- Adds `fn TypeId::fields` returns the number of fields.
- Adds `fn TypeId::field` returns a field representing type `FieldId`.
- Adds a new type `FieldId`, which is a wrapper of `FieldRepresentingType`'s `TypeId`.

For methods `{fields,field}`, if indexing out of bounds, a compile-time error will be raised.

Regarding the removal of `Type` items, this will be done in a later PR in one go.

r? @oli-obk
2026-05-28 07:53:35 +02:00
bors 8f02e856be Auto merge of #157037 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to https://github.com/rust-lang/compiler-builtins/commit/8bf32936feec8c4cca6d56c7ab46c3631d37485c.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-05-28 01:53:52 +00:00
Asuna b513e539c3 FieldId wraps FRT TypeId instead of the actual field TypeId 2026-05-27 22:25:09 +00:00
Guillaume Gomez 7ade8cceb6 Rollup merge of #157002 - willnode:redox-nproc, r=bjorn3
std: Fix thread::available_parallelism on Redox targets

This brings support to `thread::available_parallelism` on Redox targets via `sysconf`. It has been available since `libc 0.2.177` and tested for months.

References:
- [libc implementation](https://github.com/rust-lang/libc/pull/4728)
- [downstream patch](https://gitlab.redox-os.org/redox-os/rust/-/merge_requests/27)
2026-05-27 20:45:16 +02:00
Guillaume Gomez b464e29405 Rollup merge of #156390 - Randl:iter_related_const, r=oli-obk
Constify Iterator-related methods and functions

These functions are required to eventually constify `Iterator`

r? @oli-obk
2026-05-27 20:45:11 +02:00
Ralf Jung 59428e76e8 MIR inlining: allow backends to opt-in to inlining intrinsics 2026-05-27 13:59:25 +02:00
Aelin Reidel 628b0b9a50 Upgrade taiki-e/install-action to 2.79.8
This release includes support for ppc64.
2026-05-26 21:51:58 -05:00
Wildan M 1f02e4d1df std: Fix thread::available_parallelism on Redox targets 2026-05-27 07:39:24 +07:00
bors d1fc603d17 Auto merge of #156385 - RalfJung:tcp-ports, r=nia-e
std::net::tcp: let the OS pick the port numbers



See rust-lang/rust#156377 for context.
I only did the TCP tests for now to see whether there are any unexpected problems.
2026-05-26 19:36:32 +00:00
Jonathan Brouwer d8a003a6d9 Rollup merge of #156761 - kcx1:fix/156730, r=tgross35
tidy: remove duplicate entry and alphabetize OS constants list
2026-05-26 13:42:17 +02:00
Jonathan Brouwer 903a08c0b0 Rollup merge of #156161 - mejrs:this_formatargs, r=oli-obk
rustc_on_unimplemented: introduce format specifiers

...as printing options for the annotated item.

See also the test and dev guide prose. This only affects rustc_on_unimplemented, not (yet) the other diagnostic attributes. I plan to do that in some later PR.

```rust
#![feature(rustc_attrs)]

#[rustc_on_unimplemented(
    message = "normal: {This}, path: {This:path},  resolved: {This:resolved}"
)]
pub trait Trait<'lifetime, const CONST_GENERIC: usize, A, B> where A: Send {}
```
will do:
```
normal: Trait, path: Trait<'lifetime, CONST_GENERIC, A, B>,  resolved: Trait<'_, 6, u8, _>
```
2026-05-26 13:42:16 +02:00
Jonathan Brouwer d1d13020f4 Rollup merge of #156959 - folkertdev:stdarch-sync-2026-05-26, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/18ca8c5d7637b6bd5aa166d3b6ccdbb24db86c7e.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-05-26 13:42:14 +02:00
Aelin 79bb9f71e7 symcheck: Only ELFv1 ppc64 doesn't set .note.GNU-stack
`powerpc64-unknown-linux-gnu` currently is an ELFv1 target, while
`powerpc64-unknown-linux-musl` is an ELFv2 target.

Big-endian and little-endian ELFv2 targets both behave normally: they emit
`.note.GNU-stack`. Therefore, currently the tests would fail on big-endian
powerpc64 with ELFv2 ABI.

To determine whether we need to special-case powerpc64, we should check
the ABI instead of the endianness. The problem here is that the `e_flags`
part of the ELF header is actually `0` in the output of `cc -O0
-ffunction-sections -fdata-sections -fPIC -m64 -mabi=elfv2 -Wall -Wextra
-o missing_gnu_stack_section.o -c missing_gnu_stack_section.S`, the output
of that command is bit-for-bit identical on ELFv1 and ELFv2 hosts. In
order to know when to allow an unset `.note.GNU-stack` we therefore must
set `.abiversion 2` to be able to tell them apart from the ELF header.

This makes all tests pass on `powerpc64-unknown-linux-musl`.
2026-05-26 06:03:19 -05:00
xonx 527ed7ff85 add optional output-dir argument 2026-05-26 04:43:06 +00:00
bors 31a9463c6e Auto merge of #156930 - JonathanBrouwer:rollup-NuilniS, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#156764 (tests: fix pub-priv-dep test expectation)
 - rust-lang/rust#156825 (compiletest: sort unexpected and unimportant errors)
 - rust-lang/rust#156878 (codegen: re-enable FileCheck for scalable-vector tuple intrinsics)
 - rust-lang/rust#156909 (Rewrite documentation that said to implement `Into`)
2026-05-25 20:03:42 +00:00
Jonathan Brouwer 62bb58892b Rollup merge of #156909 - joshtriplett:into-docs, r=SimonSapin
Rewrite documentation that said to implement `Into`
2026-05-25 20:54:08 +02:00
bors c854ac880b Auto merge of #156594 - LimpSquid:stabilize-bool-to-result, r=SimonSapin
Stabilize bool_to_result

Closes https://github.com/rust-lang/rust/issues/142748
2026-05-25 16:51:27 +00:00
Amanieu d'Antras 4c6f3734fd Merge pull request #2129 from heiher/vrepl-128-ve-0-i
loongarch: Use `intrinsics::simd` for vrepl{128}ve{0,i}
2026-05-25 13:43:44 +00:00
bors 6083f7891b Auto merge of #156900 - folkertdev:stdarch-sync-2026-05-25, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/5e930b6ecfb23546096db5e026f04d957a626f1e.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-05-25 10:00:42 +00:00
Sayantan Chakraborty b8e62d7e63 Merge pull request #2136 from Gelbpunkt/la64-crc
Several fixes to the loongarch CRC intrinsics
2026-05-25 02:38:31 +00:00
Folkert de Vries e1dede4ffe Merge pull request #2127 from davidtwco/intrinsic-test-remove-arm-argument
intrinsic-test: remove `arm::argument` module
2026-05-24 21:59:50 +00:00
Aelin Reidel 606d022b99 loongarch: Align CRC intrinsic signatures with clang and GCC
Clang and GCC use char and short for the data parameter type where
appropriate. The LLVM intrinsics take an i32. We should match clang and
perform a cast here.
2026-05-24 23:50:54 +02:00
Aelin Reidel 035d7ddfa3 loongarch: CRC intrinsics require loongarch64
GCC and LLVM both only allow using the CRC intrinsics on LA64.
2026-05-24 23:46:26 +02:00
sayantn 44475cc694 Add intrinsic-test ICX run 2026-05-24 20:24:35 +05:30
sayantn fd9acfb428 Add intrinsic-test GCC run 2026-05-24 20:24:32 +05:30
Jacob Pratt 9c63e94ef7 Rollup merge of #156810 - Teufelchen1:fix_doc_typo, r=SimonSapin
Fix doc typo in Vec::into_array and convert Arc/Box/Rc::into_arry to -> Result

Hello 🪼,

the first commit fixes a documentation mistake added in the recent PR rust-lang/rust#156234

The second commit addresses three function signature changes as defined by the tracking issue rust-lang/rust#148082
It converts all `.into_array() -> Option<>` into `.into_array() -> Result<>`

The third commit is a fixup for the second. The change is needed as calling `unwrap()` on `Err(E)` requires `E` to implement `Debug`. I thought `Vec<T, A> where T: Debug` is not an acceptable solution, so I tried to come up with my own. I am *NOT* confident in my `unsafe {}`  code due to lack of expierence, please check extra carefully.

Appreciating feedback & greetings from the RustWeek,
Thanks!
2026-05-24 16:39:41 +02:00
Folkert de Vries c1e2d637c7 Merge pull request #2130 from adamgemmell/dev/adagem01/chunk-size
intrinsic-test fixes for low intrinsic, high core counts
2026-05-24 14:17:49 +00:00
Bennet Blischke 8b382d62df Return result instead of option by Arc/Rc/Box::into_array 2026-05-24 11:39:35 +02:00
Jonathan Brouwer e8d2321b41 Rollup merge of #156830 - okaneco:phi_doc_alias, r=SimonSapin
Add `#[doc(alias = "phi")]` for float `GOLDEN_RATIO` constants

- Adds "phi" doc alias for `f16`, `f32`, `f64`, and `f128`

I knew this constant was stabilized but I couldn't remember what it was called.
Searching "phi" in the docs only surfaces the π constant, `is_ascii_graphic`, and `spin_loop_hint` methods. This alias would make it much easier to find.
https://doc.rust-lang.org/nightly/std/?search=phi
2026-05-24 08:27:21 +02:00
Jonathan Brouwer eb68b36521 Rollup merge of #156828 - P8L1:share-trait-core-bootstrap, r=SimonSapin
Add unstable Share trait

Tracking issue: rust-lang/rust#156756

This adds an initial unstable `Share` trait for clone-as-alias types, as part of the 2026 ergonomic ref-counting project goal.

```rust
pub trait Share: Clone {
    fn share(&self) -> Self {
        Clone::clone(self)
    }
}
```

This PR adds a separate unstable feature gate:

```rust
#![feature(share_trait)]
```

and places the trait next to `Clone` in `core::clone`.

Implemented initial impls:

- `impl<T: ?Sized> Share for &T`
- `impl<T: ?Sized, A: Allocator + Clone> Share for Rc<T, A>`
- `impl<T: ?Sized, A: Allocator + Clone> Share for Arc<T, A>`
- `impl<T> Share for std::sync::mpsc::Sender<T>`
- `impl<T> Share for std::sync::mpsc::SyncSender<T>`

The PR deliberately does not add `Share` to the prelude.

r? @nikomatsakis
@rustbot label F-ergonomic_clones
2026-05-24 08:27:21 +02:00
Josh Triplett 8edc0696b9 Rewrite documentation that said to implement Into 2026-05-24 07:34:39 +02:00
Taiki Endo 8d74557a0c Workaround rustfmt issue around impl const 2026-05-23 15:36:16 +09:00
Taiki Endo 8684b3a37a stdarch-gen-hexagon-scalar: Do not emit inline(always) if target_feature is used 2026-05-23 14:55:20 +09:00
Pieter-Louis Schoeman 501ab4e8c5 Clarify Share trait docs 2026-05-22 16:21:32 +02:00
okaneco 3a6cb0519d Add #[doc(alias = "phi")] for float GOLDEN_RATIO constants 2026-05-22 09:15:36 -04:00
Pieter-Louis Schoeman c01e32073c Document unstable Share trait semantics 2026-05-22 07:21:45 +02:00
Pieter-Louis Schoeman 9b3cd578ab Remove provisional Share trait FIXME notes 2026-05-22 07:13:06 +02:00
bors 3bf5c6d99b Auto merge of #152112 - Kobzol:vec-deque-strongly-typed, r=joboet
Use strongly typed wrapped indices in `VecDeque`



This is far from perfect, but it would have prevented https://github.com/rust-lang/rust/pull/151769.

r? @joboet
2026-05-22 02:21:11 +00:00
Pieter-Louis Schoeman 4a32c28276 Add Share impl for mpsc SyncSender 2026-05-22 00:16:29 +02:00
Pieter-Louis Schoeman 4b32cb2b00 Add Share impl for mpsc Sender 2026-05-22 00:14:24 +02:00
Pieter-Louis Schoeman 78b0f9db85 Add Share impl for Arc 2026-05-22 00:11:38 +02:00
Pieter-Louis Schoeman fc33b6d4f4 Add Share impl for Rc 2026-05-22 00:09:24 +02:00
Asuna 28733aa84b Add TypeId::field method to get a field representing type for type_info 2026-05-21 21:18:33 +00:00
Pieter-Louis Schoeman 02109ee822 Implement Share for shared references 2026-05-21 22:43:27 +02:00
Pieter-Louis Schoeman e5a67968e6 Add unstable Share trait 2026-05-21 22:43:27 +02:00
Adam Gemmell ac4c70b326 Don't run doctests 2026-05-21 17:13:42 +01:00
Adam Gemmell 4bd7165aa5 Fix chunk count 2026-05-21 17:13:31 +01:00
Bennet Blischke d9ab6d6e2d Correct doc of Vec::into_array: Returns Err(Self) instead of None 2026-05-21 18:07:22 +02:00
Jonathan Brouwer 8162cf582b Rollup merge of #156242 - Jamesbarford:feat/remove-alwaysinline+target-feature, r=RalfJung,saethlin
Remove unsound `target_feature_inline_always` feature

## Summary
- Remove `target_feature_inline_always`
- Update stdarch generators to only use `#[inline]` & regenerate stdarch.

## Why?
Succinctly; the feature relies on LLVMs `AlwaysInlinerPass()` running before LLVMs heuristic based inliner pass. Which is not a basis for sound code.

This has been discussed in [the tracking issue](https://github.com/rust-lang/rust/issues/145574).

If the ordering of the passes were to change, of which they have in the past, it is very possible we could inline functions across callsites with mismatching target features leading to unsound code. Checks proposed in; https://github.com/rust-lang/rust/pull/155426 would only take into account caller -> callee which is not enough to guard against possibly of generating unsound code if the pass ordering were to change.

There doesn't seem to be a way, presently, this this mechanism to provide soundness guarantees nor does it seem like `AlwaysInlinerPass()` is a desired feature of LLVM, which this feature relies on.

r? @RalfJung
2026-05-21 12:21:45 +02:00
WANG Rui 7c7e9cd820 loongarch: Use intrinsics::simd for vrepl{128}ve{0,i} 2026-05-21 11:35:10 +08:00