about summary refs log tree commit diff
path: root/compiler/rustc_feature/src/accepted.rs
AgeCommit message (Collapse)AuthorLines
2025-09-26Update CURRENT_RUSTC_VERSION post-bumpMark Rousskov-3/+3
2025-09-02stabilize extended_varargs_abi_supportRalf Jung-0/+3
2025-08-14Stabilize `sse4a` and `tbm` target featuressayantn-0/+4
- remove some stabilized target features from `gate.rs`
2025-07-02Auto merge of #143214 - camsteffen:remove-let-chains-feature, r=est31bors-0/+2
Remove let_chains unstable feature Per https://github.com/rust-lang/rust/issues/53667#issuecomment-3016742982 (but then I also noticed rust-lang/rust#140722) This replaces the feature gate with a parser error that says let chains require 2024. A lot of tests were using the unstable feature. I either added edition:2024 to the test or split out the parts that require 2024.
2025-07-01Update version placeholdersJosh Stone-5/+5
2025-06-30Remove let_chains featureCameron Steffen-0/+2
2025-06-28fix typos on some doc commentsTshepang Mbambo-2/+2
2025-06-11stabilize gaiBoxy-0/+2
2025-06-10Rollup merge of #140766 - sayantn:stabilize-keylocker, r=traviscross,tgross35León Orell Valerian Liehr-0/+2
Stabilize keylocker This PR stabilizes the feature flag `keylocker_x86` (tracking issue rust-lang/rust#134813). # Public API The 2 `x86` target features `kl` and `widekl`, and the associated intrinsics in stdarch. These target features are very specialized, and are only used to signal the presence of the corresponding CPU instruction. They don't have any nontrivial interaction with the ABI (contrary to something like AVX), and serve the only purpose of enabling 11 stdarch intrinsics, all of which have been implemented and propagated to rustc via a stdarch submodule update. Also, these were added way back in LLVM12, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too! # Associated PRs - rust-lang/rust#134814 - rust-lang/stdarch#1706 - rust-lang/rust#136831 (stdarch submodule update) - rust-lang/stdarch#1795 (stabilizing the runtime detection and intrinsics) - rust-lang/rust#141964 (stdarch submodule update for the stabilization of the runtime detection and intrinsics) As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now. cc ````@rust-lang/lang```` cc ````@rust-lang/libs-api```` for the intrinsics and runtime detection I don't think anyone else worked on this feature, so no one else to ping, maybe cc ````@Amanieu.```` I will send the reference pr soon.
2025-06-07Stabilize `sha512_sm_x86`, and the `sha512`, `sm3` and `sm4` target featuressayantn-0/+2
2025-06-07Stabilize the `keylocker_x86` flag, and the `kl` and `widekl` target featuressayantn-0/+2
2025-05-28Stabilise `repr128`beetrees-0/+2
2025-05-18Stabilize `avx512_target_feature`sayantn-0/+2
2025-05-12update version placeholdersPietro Albini-2/+2
2025-04-20stabilize `naked_functions`Folkert de Vries-0/+2
2025-04-17Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, ↵Matthias Krüger-0/+2
r=davidtwco,Urgau,traviscross Stabilize `cfg_boolean_literals` Closes #131204 `@rustbot` labels +T-lang +I-lang-nominated This will end up conflicting with the test in #138293 so whichever doesn't land first will need updating -- # Stabilization Report ## General design ### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? [RFC 3695](https://github.com/rust-lang/rfcs/pull/3695), none. ### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. None ### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? None ## Has a call-for-testing period been conducted? If so, what feedback was received? Yes; only positive feedback was received. ## Implementation quality ### Summarize the major parts of the implementation and provide links into the code (or to PRs) Implemented in [#131034](https://github.com/rust-lang/rust/pull/131034). ### Summarize existing test coverage of this feature - [Basic usage, including `#[cfg()]`, `cfg!()` and `#[cfg_attr()]`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/true-false.rs) - [`--cfg=true/false` on the command line being accessible via `r#true/r#false`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/raw-true-false.rs) - [Interaction with the unstable `#[doc(cfg(..))]` feature](https://github.com/rust-lang/rust/tree/6d71251/tests/rustdoc-ui/cfg-boolean-literal.rs) - [Denying `--check-cfg=cfg(true/false)`](https://github.com/rust-lang/rust/tree/6d71251/tests/ui/check-cfg/invalid-arguments.rs) - Ensuring `--cfg false` on the command line doesn't change the meaning of `cfg(false)`: `tests/ui/cfg/cmdline-false.rs` - Ensuring both `cfg(true)` and `cfg(false)` on the same item result in it being disabled: `tests/ui/cfg/both-true-false.rs` ### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? The above mentioned issue; it should not block as it interacts with another unstable feature. ### What FIXMEs are still in the code for that feature and why is it ok to leave them there? None ### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization - `@clubby789` (RFC) - `@Urgau` (Implementation in rustc) ### Which tools need to be adjusted to support this feature. Has this work been done? `rustdoc`'s unstable`#[doc(cfg(..)]` has been updated to respect it. `cargo` has been updated with a forward compatibility lint to enable supporting it in cargo once stabilized. ## Type system and execution rules ### What updates are needed to the reference/specification? (link to PRs when they exist) A few lines to be added to the reference for configuration predicates, specified in the RFC.
2025-04-09replace version placeholderBoxy-2/+2
2025-04-03Stabilize `cfg_boolean_literals`clubby789-0/+2
2025-03-23Stabilize precise_capturing_in_traitsMichael Goulet-0/+2
2025-03-17Stabilize asm_gotoGary Guo-0/+2
2025-02-18update version placeholdersJosh Stone-2/+2
(cherry picked from commit e4840ce59bdddb19394df008c5c26d9c493725f8)
2025-02-12Rollup merge of #134090 - veluca93:stable-tf11, r=oli-obkJacob Pratt-0/+2
Stabilize target_feature_11 # Stabilization report This is an updated version of https://github.com/rust-lang/rust/pull/116114, which is itself a redo of https://github.com/rust-lang/rust/pull/99767. Most of this commit and report were copied from those PRs. Thanks ```@LeSeulArtichaut``` and ```@calebzulawski!``` ## Summary Allows for safe functions to be marked with `#[target_feature]` attributes. Functions marked with `#[target_feature]` are generally considered as unsafe functions: they are unsafe to call, cannot *generally* be assigned to safe function pointers, and don't implement the `Fn*` traits. However, calling them from other `#[target_feature]` functions with a superset of features is safe. ```rust // Demonstration function #[target_feature(enable = "avx2")] fn avx2() {} fn foo() { // Calling `avx2` here is unsafe, as we must ensure // that AVX is available first. unsafe { avx2(); } } #[target_feature(enable = "avx2")] fn bar() { // Calling `avx2` here is safe. avx2(); } ``` Moreover, once https://github.com/rust-lang/rust/pull/135504 is merged, they can be converted to safe function pointers in a context in which calling them is safe: ```rust // Demonstration function #[target_feature(enable = "avx2")] fn avx2() {} fn foo() -> fn() { // Converting `avx2` to fn() is a compilation error here. avx2 } #[target_feature(enable = "avx2")] fn bar() -> fn() { // `avx2` coerces to fn() here avx2 } ``` See the section "Closures" below for justification of this behaviour. ## Test cases Tests for this feature can be found in [`tests/ui/target_feature/`](https://github.com/rust-lang/rust/tree/f6cb952dc115fd1311b02b694933e31d8dc8b002/tests/ui/target-feature). ## Edge cases ### Closures * [target-feature 1.1: should closures inherit target-feature annotations? #73631](https://github.com/rust-lang/rust/issues/73631) Closures defined inside functions marked with #[target_feature] inherit the target features of their parent function. They can still be assigned to safe function pointers and implement the appropriate `Fn*` traits. ```rust #[target_feature(enable = "avx2")] fn qux() { let my_closure = || avx2(); // this call to `avx2` is safe let f: fn() = my_closure; } ``` This means that in order to call a function with #[target_feature], you must guarantee that the target-feature is available while the function, any closures defined inside it, as well as any safe function pointers obtained from target-feature functions inside it, execute. This is usually ensured because target features are assumed to never disappear, and: - on any unsafe call to a `#[target_feature]` function, presence of the target feature is guaranteed by the programmer through the safety requirements of the unsafe call. - on any safe call, this is guaranteed recursively by the caller. If you work in an environment where target features can be disabled, it is your responsibility to ensure that no code inside a target feature function (including inside a closure) runs after this (until the feature is enabled again). **Note:** this has an effect on existing code, as nowadays closures do not inherit features from the enclosing function, and thus this strengthens a safety requirement. It was originally proposed in #73631 to solve this by adding a new type of UB: “taking a target feature away from your process after having run code that uses that target feature is UB” . This was motivated by userspace code already assuming in a few places that CPU features never disappear from a program during execution (see i.e. https://github.com/rust-lang/stdarch/blob/2e29bdf90832931ea499755bb4ad7a6b0809295a/crates/std_detect/src/detect/arch/x86.rs); however, concerns were raised in the context of the Linux kernel; thus, we propose to relax that requirement to "causing the set of usable features to be reduced is unsafe; when doing so, the programmer is required to ensure that no closures or safe fn pointers that use removed features are still in scope". * [Fix #[inline(always)] on closures with target feature 1.1 #111836](https://github.com/rust-lang/rust/pull/111836) Closures accept `#[inline(always)]`, even within functions marked with `#[target_feature]`. Since these attributes conflict, `#[inline(always)]` wins out to maintain compatibility. ### ABI concerns * [The extern "C" ABI of SIMD vector types depends on target features #116558](https://github.com/rust-lang/rust/issues/116558) The ABI of some types can change when compiling a function with different target features. This could have introduced unsoundness with target_feature_11, but recent fixes (#133102, #132173) either make those situations invalid or make the ABI no longer dependent on features. Thus, those issues should no longer occur. ### Special functions The `#[target_feature]` attribute is forbidden from a variety of special functions, such as main, current and future lang items (e.g. `#[start]`, `#[panic_handler]`), safe default trait implementations and safe trait methods. This was not disallowed at the time of the first stabilization PR for target_features_11, and resulted in the following issues/PRs: * [`#[target_feature]` is allowed on `main` #108645](https://github.com/rust-lang/rust/issues/108645) * [`#[target_feature]` is allowed on default implementations #108646](https://github.com/rust-lang/rust/issues/108646) * [#[target_feature] is allowed on #[panic_handler] with target_feature 1.1 #109411](https://github.com/rust-lang/rust/issues/109411) * [Prevent using `#[target_feature]` on lang item functions #115910](https://github.com/rust-lang/rust/pull/115910) ## Documentation * Reference: [Document the `target_feature_11` feature reference#1181](https://github.com/rust-lang/reference/pull/1181) --- cc tracking issue https://github.com/rust-lang/rust/issues/69098 cc ```@workingjubilee``` cc ```@RalfJung``` r? ```@rust-lang/lang```
2025-02-11Revert "Stabilize `extended_varargs_abi_support`"Jubilee Young-3/+0
This reverts commit 685f189b4307435b83d625fea397ef36dff4e955.
2025-02-07Rollup merge of #134367 - WaffleLapkin:trait_upcasting_as_a_treat, ↵Matthias Krüger-0/+3
r=compiler-errors Stabilize `feature(trait_upcasting)` This feature was "done" for a while now, I think it's finally time to stabilize it! Stabilization report: https://github.com/rust-lang/rust/pull/134367#issuecomment-2545839841. cc reference PR: https://github.com/rust-lang/reference/pull/1622. Closes #65991 (tracking issue), closes #89460 (the lint is no longer future incompat). r? compiler-errors
2025-02-06stabilize `feature(trait_upcasting)`Waffle Lapkin-0/+3
2025-01-28replaces few consts with statics to reduce readonly sectionklensy-1/+1
2025-01-27Stabilize target_feature_11Caleb Zulawski-0/+2
2025-01-08update version placeholdersPietro Albini-3/+3
2024-12-23Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, ↵Zalathar-3/+0
r=wesleywiser" This reverts commit 1d35638dc38dbfbf1cc2a9823135dfcf3c650169, reversing changes made to f23a80a4c2fbca593b64e70f5970368824b4c5e9.
2024-12-18Stabilize `#[diagnostic::do_not_recommend]`Georg Semmler-0/+2
This commit seeks to stabilize the `#[diagnostic::do_not_recommend]` attribute. This attribute was first proposed as `#[do_not_recommend`] attribute in RFC 2397 (https://github.com/rust-lang/rfcs/pull/2397). It gives the crate authors the ability to not suggest to the compiler to not show certain traits in it's error messages. With the presence of the `#[diagnostic]` tool attribute namespace it was decided to move the attribute there, as that lowers the amount of guarantees the compiler needs to give about the exact way this influences error messages. It turns the attribute into a hint which can be ignored. In addition to the original proposed functionality this attribute now also hides the marked trait in help messages ("This trait is implemented by: "). The attribute does not accept any argument and can only be placed on trait implementations. If it is placed somewhere else a lint warning is emitted and the attribute is otherwise ignored. If an argument is detected a lint warning is emitted and the argument is ignored. This follows the rules outlined by the diagnostic namespace. This attribute allows crates like diesel to improve their error messages drastically. The most common example here is the following error message: ``` error[E0277]: the trait bound `&str: Expression` is not satisfied --> /home/weiznich/Documents/rust/rust/tests/ui/diagnostic_namespace/do_not_recommend.rs:53:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `Expression` is not implemented for `&str`, which is required by `&str: AsExpression<Integer>` | = help: the following other types implement trait `Expression`: Bound<T> SelectInt note: required for `&str` to implement `AsExpression<Integer>` --> /home/weiznich/Documents/rust/rust/tests/ui/diagnostic_namespace/do_not_recommend.rs:26:13 | LL | impl<T, ST> AsExpression<ST> for T | ^^^^^^^^^^^^^^^^ ^ LL | where LL | T: Expression<SqlType = ST>, | ------------------------ unsatisfied trait bound introduced here ``` By applying the new attribute to the wild card trait implementation of `AsExpression` for `T: Expression` the error message becomes: ``` error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied --> $DIR/as_expression.rs:55:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` | = help: the trait `AsExpression<Text>` is implemented for `&str` = help: for that trait implementation, expected `Text`, found `Integer` ``` which makes it much easier for users to understand that they are facing a type mismatch. Other explored example usages included * This standard library error message: https://github.com/rust-lang/rust/pull/128008 * That bevy derived example: https://github.com/rust-lang/rust/blob/e1f306899514ea80abc1d1c9f6a57762afb304a3/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs (No more tuple pyramids) Fixes #51992
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-16Stabilize #[coverage] attributeltdk-0/+3
2024-12-13Stabilize async closuresMichael Goulet-0/+2
2024-11-30Rollup merge of #116161 - Soveu:varargs2, r=cjgillot许杰友 Jieyou Xu (Joe)-0/+3
Stabilize `extended_varargs_abi_support` I think that is everything? If there is any documentation regarding `extern` and/or varargs to correct, let me know, some quick greps suggest that there might be none. Tracking issue: https://github.com/rust-lang/rust/issues/100189
2024-11-27Stabilize `extended_varargs_abi_support`Soveu-0/+3
2024-11-27replace placeholder versionBoxy-3/+3
2024-10-29Rollup merge of #131984 - dingxiangfei2009:stabilize-if-let-rescope, ↵Matthias Krüger-0/+2
r=traviscross,lcnr Stabilize if_let_rescope Close #131154 Tracked by #124085
2024-10-24stabilize if_let_rescopeDing Xiang Fei-0/+2
2024-10-24stabilize shorter-tail-lifetimesDing Xiang Fei-0/+2
2024-10-23rename lang feature lists to include LANGRalf Jung-1/+1
2024-10-19`result_ffi_guarantees` stabilizes in `$CURRENT_RUSTC_VERSION`Jubilee-1/+1
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-10-19compiler: Fully stabilize `result_ffi_guarantees`Jubilee Young-0/+3
2024-10-15replace placeholder versionJosh Stone-5/+5
(cherry picked from commit 567fd9610cbfd220844443487059335d7e1ff021)
2024-10-01Stabilize expr_2021 fragment in all editionsEric Holk-0/+2
Co-authored-by: Michael Goulet <michael@errs.io> Co-authored-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-09-26Stabilize `const_refs_to_static`Ding Xiang Fei-0/+2
update tests fix bitwidth-sensitive stderr output use build-fail for asm tests
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-15also stabilize const_refs_to_cellRalf Jung-0/+2
2024-09-15stabilize const_mut_refsRalf Jung-0/+2
2024-09-14stabilize `const_extern_fn`Folkert de Vries-0/+2
2024-09-03replace placeholder versionBoxy-8/+8