Stabilize 29 RISC-V target features (riscv_ratified_v2)#145948
Stabilize 29 RISC-V target features (riscv_ratified_v2)#145948bors merged 1 commit intorust-lang:mainfrom
riscv_ratified_v2)#145948Conversation
|
Some changes occurred in compiler/rustc_codegen_ssa |
|
I expect that this PR lands on the version 1.92 cycle (I chose extensions with relatively low risk factors) but happy if it could be merged in the version 1.91 cycle. |
|
LGTM, these are all officially ratified RISC-V extensions. @rfcbot merge |
|
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
Consideration: Feature Naming (for
|
The `Zb` extension does not exist and we instead have the `B` extension which is a superset of the three subextensions: `Zba`, `Zbb` and `Zbs`. This commit fixes this issue and updates the reference URL to the source code of the latest ratified ISA Manual (version 20250508). To align with rust-lang/rust#145948, this commit performs rename, not removal.
Because unstable "B" (incorrectly named as `zb`) was there, this commit
adds 28 minus one ("B") new extensions to be stabilized.
This commit directly corresponds to rust-lang/rust#145948.
References:
1. RISC-V Instruction Set Manual (version 20250508):
<https://github.com/riscv/riscv-isa-manual/tree/20250508>
2. RISC-V Profiles (version 1.0 - RVA23 is not stabilized at the time):
<https://github.com/riscv/riscv-profiles/tree/v1.0>
3. RISC-V Profiles (RVA23/RVB23-ratified version):
<https://github.com/riscv/riscv-profiles/tree/rva23-rvb23-ratified>
The `Zb` extension does not exist and we instead have the `B` extension which is a superset of the three subextensions: `Zba`, `Zbb` and `Zbs`. This commit fixes this issue and updates the reference URL to the source code of the latest ratified ISA Manual (version 20250508). To align with rust-lang/rust#145948, this commit performs rename, not removal.
Because unstable "B" (incorrectly named as `zb`) was there, this commit
adds 28 minus one ("B") new extensions to be stabilized.
This commit directly corresponds to rust-lang/rust#145948.
References:
1. RISC-V Instruction Set Manual (version 20250508):
<https://github.com/riscv/riscv-isa-manual/tree/20250508>
2. RISC-V Profiles (version 1.0 - RVA23 is not stabilized at the time):
<https://github.com/riscv/riscv-profiles/tree/v1.0>
3. RISC-V Profiles (RVA23/RVB23-ratified version):
<https://github.com/riscv/riscv-profiles/tree/rva23-rvb23-ratified>
The `Zb` extension does not exist and we instead have the `B` extension which is a superset of the three subextensions: `Zba`, `Zbb` and `Zbs`. This commit fixes this issue and updates the reference URL to the source code of the latest ratified ISA Manual (version 20250508). To align with rust-lang/rust#145948, this commit performs rename, not removal.
Because unstable "B" (incorrectly named as `zb`) was there, this commit
adds 28 minus one ("B") new extensions to be stabilized.
This commit directly corresponds to rust-lang/rust#145948.
References:
1. RISC-V Instruction Set Manual (version 20250508):
<https://github.com/riscv/riscv-isa-manual/tree/20250508>
2. RISC-V Profiles (version 1.0 - RVA23 is not stabilized at the time):
<https://github.com/riscv/riscv-profiles/tree/v1.0>
3. RISC-V Profiles (RVA23/RVB23-ratified version):
<https://github.com/riscv/riscv-profiles/tree/rva23-rvb23-ratified>
The list looks good to me. |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
|
@bors r+ |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 50d5940 (parent) -> 00f49d2 (this PR) Test differencesShow 2 test diffs2 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 00f49d22042dce59561b36eb075bbf5e343c23c4 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (00f49d2): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary 3.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 470.889s -> 472.503s (0.34%) |
Pkgsrc changes: * Update version & checksums. * Adapt patches to new vendored crates. This has so far just been verified to build on NetBSD/amd64. Upstream changes relative to 1.93.1: Version 1.94.0 (2026-03-05) ========================== Language -------- - [Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items] (rust-lang/rust#144113) - [Stabilize additional 29 RISC-V target features including large portions of the RVA22U64 / RVA23U64 profiles] (rust-lang/rust#145948) - [Add warn-by-default `unused_visibilities` lint for visibility on `const _` declarations] (rust-lang/rust#147136) - [Update to Unicode 17] (rust-lang/rust#148321) - [Avoid incorrect lifetime errors for closures] (rust-lang/rust#148329) Platform Support ---------------- - [Add `riscv64im-unknown-none-elf` as a tier 3 target] (rust-lang/rust#148790) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. [platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html Libraries --------- - [Relax `T: Ord` bound for some `BinaryHeap<T>` methods.] (rust-lang/rust#149408) Stabilized APIs --------------- - [`<[T]>::array_windows`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.array_windows) - [`<[T]>::element_offset`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.element_offset) - [`LazyCell::get`] (https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.get) - [`LazyCell::get_mut`] (https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.get_mut) - [`LazyCell::force_mut`] (https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.force_mut) - [`LazyLock::get`] (https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.get) - [`LazyLock::get_mut`] (https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.get_mut) - [`LazyLock::force_mut`] (https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.force_mut) - [`impl TryFrom<char> for usize`] (https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3Cchar%3E-for-usize) - [`std::iter::Peekable::next_if_map`] (https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_map) - [`std::iter::Peekable::next_if_map_mut`] (https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_map_mut) - [x86 `avx512fp16` intrinsics] (rust-lang/rust#127213) (excluding those that depend directly on the unstable `f16` type) - [AArch64 NEON fp16 intrinsics] (rust-lang/rust#136306) (excluding those that depend directly on the unstable `f16` type) - [`f32::consts::EULER_GAMMA`] (https://doc.rust-lang.org/stable/std/f32/consts/constant.EULER_GAMMA.html) - [`f64::consts::EULER_GAMMA`] (https://doc.rust-lang.org/stable/std/f64/consts/constant.EULER_GAMMA.html) - [`f32::consts::GOLDEN_RATIO`] (https://doc.rust-lang.org/stable/std/f32/consts/constant.GOLDEN_RATIO.html) - [`f64::consts::GOLDEN_RATIO`] (https://doc.rust-lang.org/stable/std/f64/consts/constant.GOLDEN_RATIO.html) These previously stable APIs are now stable in const contexts: - [`f32::mul_add`] (https://doc.rust-lang.org/stable/std/primitive.f32.html#method.mul_add) - [`f64::mul_add`] (https://doc.rust-lang.org/stable/std/primitive.f64.html#method.mul_add) Cargo ----- - Stabilize the config include key. The top-level include config key allows loading additional config files, enabling better organization, sharing, and management of Cargo configurations across projects and environments. [docs] (https://doc.rust-lang.org/nightly/cargo/reference/config.html#including-extra-configuration-files) [#16284] (rust-lang/cargo#16284) - Stabilize the pubtime field in registry index. This records when a crate version was published and enables time-based dependency resolution in the future. Note that crates.io will gradually backfill existing packages when a new version is published. Not all crates have pubtime yet. [#16369] (rust-lang/cargo#16369) [#16372] (rust-lang/cargo#16372) - Cargo now parses [TOML v1.1](https://toml.io/en/v1.1.0) for manifests and configuration files. Note that using these features in Cargo.toml will raise your development MSRV, but the published manifest remains compatible with older parsers. [#16415] (rust-lang/cargo#16415) - [Make `CARGO_BIN_EXE_<crate>` available at runtime ] (rust-lang/cargo#16421) Compatibility Notes ------------------- - [Forbid freely casting lifetime bounds of `dyn`-types] (rust-lang/rust#136776) - [Make closure capturing have consistent and correct behaviour around patterns] (rust-lang/rust#138961) Some finer details of how precise closure captures get affected by pattern matching have been changed. In some cases, this can cause a non-move closure that was previously capturing an entire variable by move, to now capture only part of that variable by move, and other parts by borrow. This can cause the borrow checker to complain where it previously didn't, or cause `Drop` to run at a different point in time. - [Standard library macros are now imported via prelude, not via injected ` #[macro_use]`] (rust-lang/rust#139493) This will raise an error if macros of the same name are glob imported. For example if a crate defines their own `matches` macro and then glob imports that, it's now ambiguous whether the custom or standard library `matches` is meant and an explicit import of the name is required to resolve the ambiguity. One exception is `core::panic` and `std::panic`, if their import is ambiguous a new warning ([`ambiguous_panic_imports`] (rust-lang/rust#147319)) is raised. This may raise a new warning ([`ambiguous_panic_imports`] (rust-lang/rust#147319)) on `#![no_std]` code glob importing the std crate. Both `core::panic!` and `std::panic!` are then in scope and which is used is ambiguous. - [Don't strip shebang in expression-context `include!(…)`s] (rust-lang/rust#146377) This can cause previously working includes to no longer compile if they included files which started with a shebang. - [Ambiguous glob reexports are now also visible cross-crate] (rust-lang/rust#147984) This unifies behavior between local and cross-crate errors on these exports, which may introduce new ambiguity errors. - [Don't normalize where-clauses before checking well-formedness] (rust-lang/rust#148477) - [Introduce a future compatibility warning on codegen attributes on body-free trait methods] (rust-lang/rust#148756) These attributes currently have no effect in this position. - [On Windows `std::time::SystemTime::checked_sub_duration` will return `None` for times before the Windows epoch (1/1/1601)] (rust-lang/rust#148825) - [Lifetime identifiers such as `'a` are now NFC normalized] (rust-lang/rust#149192). - [Overhaul filename handling for cross-compiler consistency] (rust-lang/rust#149709) Any paths emitted by compiler now always respect the relative-ness of the paths and `--remap-path-prefix` given originally. One side-effect of this change is that paths emitted for local crates in Cargo (path dependencies and workspace members) are no longer absolute but relative when emitted as part of a diagnostic in a downstream crate. Internal Changes ---------------- These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools. - [Switch to `annotate-snippets` for error emission] (rust-lang/rust#150032) This should preserve mostly the same outputs in rustc error messages.
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [rust](https://github.com/rust-lang/rust) | minor | `1.93.1` → `1.94.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>rust-lang/rust (rust)</summary> ### [`v1.94.0`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1940-2026-03-05) [Compare Source](rust-lang/rust@1.93.1...1.94.0) \========================== <a id="1.94.0-Language"></a> ## Language - [Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items](rust-lang/rust#144113) - [Stabilize additional 29 RISC-V target features including large portions of the RVA22U64 / RVA23U64 profiles](rust-lang/rust#145948) - [Add warn-by-default `unused_visibilities` lint for visibility on `const _` declarations](rust-lang/rust#147136) - [Update to Unicode 17](rust-lang/rust#148321) - [Avoid incorrect lifetime errors for closures](rust-lang/rust#148329) <a id="1.94.0-Platform-Support"></a> ## Platform Support - [Add `riscv64im-unknown-none-elf` as a tier 3 target](rust-lang/rust#148790) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. [platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html <a id="1.94.0-Libraries"></a> ## Libraries - [Relax `T: Ord` bound for some `BinaryHeap<T>` methods.](rust-lang/rust#149408) <a id="1.94.0-Stabilized-APIs"></a> ## Stabilized APIs - [`<[T]>::array_windows`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.array_windows) - [`<[T]>::element_offset`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.element_offset) - [`LazyCell::get`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.get) - [`LazyCell::get_mut`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.get_mut) - [`LazyCell::force_mut`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html#method.force_mut) - [`LazyLock::get`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.get) - [`LazyLock::get_mut`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.get_mut) - [`LazyLock::force_mut`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html#method.force_mut) - [`impl TryFrom<char> for usize`](https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3Cchar%3E-for-usize) - [`std::iter::Peekable::next_if_map`](https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_map) - [`std::iter::Peekable::next_if_map_mut`](https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html#method.next_if_map_mut) - [x86 `avx512fp16` intrinsics](rust-lang/rust#127213) (excluding those that depend directly on the unstable `f16` type) - [AArch64 NEON fp16 intrinsics](rust-lang/rust#136306) (excluding those that depend directly on the unstable `f16` type) - [`f32::consts::EULER_GAMMA`](https://doc.rust-lang.org/stable/std/f32/consts/constant.EULER_GAMMA.html) - [`f64::consts::EULER_GAMMA`](https://doc.rust-lang.org/stable/std/f64/consts/constant.EULER_GAMMA.html) - [`f32::consts::GOLDEN_RATIO`](https://doc.rust-lang.org/stable/std/f32/consts/constant.GOLDEN_RATIO.html) - [`f64::consts::GOLDEN_RATIO`](https://doc.rust-lang.org/stable/std/f64/consts/constant.GOLDEN_RATIO.html) These previously stable APIs are now stable in const contexts: - [`f32::mul_add`](https://doc.rust-lang.org/stable/std/primitive.f32.html#method.mul_add) - [`f64::mul_add`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.mul_add) <a id="1.94.0-Cargo"></a> ## Cargo - Stabilize the config include key. The top-level include config key allows loading additional config files, enabling better organization, sharing, and management of Cargo configurations across projects and environments. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#including-extra-configuration-files) [#​16284](rust-lang/cargo#16284) - Stabilize the pubtime field in registry index. This records when a crate version was published and enables time-based dependency resolution in the future. Note that crates.io will gradually backfill existing packages when a new version is published. Not all crates have pubtime yet. [#​16369](rust-lang/cargo#16369) [#​16372](rust-lang/cargo#16372) - Cargo now parses [TOML v1.1](https://toml.io/en/v1.1.0) for manifests and configuration files. Note that using these features in Cargo.toml will raise your development MSRV, but the published manifest remains compatible with older parsers. [#​16415](rust-lang/cargo#16415) - [Make `CARGO_BIN_EXE_<crate>` available at runtime ](rust-lang/cargo#16421) <a id="1.94.0-Compatibility-Notes"></a> ## Compatibility Notes - [Forbid freely casting lifetime bounds of `dyn`-types](rust-lang/rust#136776) - [Make closure capturing have consistent and correct behaviour around patterns](rust-lang/rust#138961) Some finer details of how precise closure captures get affected by pattern matching have been changed. In some cases, this can cause a non-move closure that was previously capturing an entire variable by move, to now capture only part of that variable by move, and other parts by borrow. This can cause the borrow checker to complain where it previously didn't, or cause `Drop` to run at a different point in time. - [Standard library macros are now imported via prelude, not via injected `#[macro_use]`](rust-lang/rust#139493) This will raise an error if macros of the same name are glob imported. For example if a crate defines their own `matches` macro and then glob imports that, it's now ambiguous whether the custom or standard library `matches` is meant and an explicit import of the name is required to resolve the ambiguity. One exception is `core::panic` and `std::panic`, if their import is ambiguous a new warning ([`ambiguous_panic_imports`](rust-lang/rust#147319)) is raised. This may raise a new warning ([`ambiguous_panic_imports`](rust-lang/rust#147319)) on `#![no_std]` code glob importing the std crate. Both `core::panic!` and `std::panic!` are then in scope and which is used is ambiguous. - [Don't strip shebang in expression-context `include!(…)`s](rust-lang/rust#146377) This can cause previously working includes to no longer compile if they included files which started with a shebang. - [Ambiguous glob reexports are now also visible cross-crate](rust-lang/rust#147984) This unifies behavior between local and cross-crate errors on these exports, which may introduce new ambiguity errors. - [Don't normalize where-clauses before checking well-formedness](rust-lang/rust#148477) - [Introduce a future compatibility warning on codegen attributes on body-free trait methods](rust-lang/rust#148756) These attributes currently have no effect in this position. - [On Windows `std::time::SystemTime::checked_sub_duration` will return `None` for times before the Windows epoch (1/1/1601)](rust-lang/rust#148825) - [Lifetime identifiers such as `'a` are now NFC normalized](rust-lang/rust#149192). - [Overhaul filename handling for cross-compiler consistency](rust-lang/rust#149709) Any paths emitted by compiler now always respect the relative-ness of the paths and `--remap-path-prefix` given originally. One side-effect of this change is that paths emitted for local crates in Cargo (path dependencies and workspace members) are no longer absolute but relative when emitted as part of a diagnostic in a downstream crate. <a id="1.94.0-Internal-Changes"></a> ## Internal Changes These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools. - [Switch to `annotate-snippets` for error emission](rust-lang/rust#150032) This should preserve mostly the same outputs in rustc error messages. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41NS4zIiwidXBkYXRlZEluVmVyIjoiNDMuNTUuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
This commit stabilizes RISC-V target features with following constraints:
Waiting for four+ version cycles seems sufficient.
target_featurecompat #140570) + ABI (cf. Some-Ctarget-features must be restrained on RISCV #132618) handling.It excludes
Eand all floating point-arithmetic extensions. TheZfinxfamily does not involve floating point registers but not stabilizing for now to avoid possible confusion between theFextension family.While integer vector subsets should not cause any ABI issues (as they don't use ABI-dependent floating point registers), we need to discuss before stabilizing them.
List of target features to be stabilized:
bza64rs(no-RT)za128rs(no-RT)zaamozabhazacaszalrsczama16b(no-RT)zawrszcazcbzcmopzic64b(no-RT)zicbomzicbop(no-RT)zicbozziccamoa(no-RT)ziccif(no-RT)zicclsm(no-RT)ziccrse(no-RT)zicntrzicondzicsrzifenceizihintntlzihintpausezihpmzimopztsoOf which, 20 of them (29 minus 9 "no-RT" target features) support runtime detection through
std::arch::is_riscv_feature_detected!().Corresponding PR for the Reference: rust-lang/reference#1987
Description in older revision(s)
The original text is rewritten to avoid confusion as per @RalfJung's request.
This is rewritten to correlate this PR with a public API (instead of an internal crate).
r? @Amanieu
@rustbot label +O-riscv