about summary refs log tree commit diff
path: root/compiler/rustc_feature/src/unstable.rs
AgeCommit message (Collapse)AuthorLines
2025-05-27support `#[cfg(...)]` on arguments to the `asm!` macrosFolkert de Vries-0/+2
2025-05-18Stabilize `avx512_target_feature`sayantn-1/+0
2025-05-12update version placeholdersPietro Albini-10/+10
2025-05-07Rollup merge of #139534 - madhav-madhusoodanan:apx-target-feature-addition, ↵Jacob Pratt-0/+1
r=workingjubilee Added support for `apxf` target feature
2025-05-06Added `apxf` target feature support, under flag `apx_target_feature`Madhav Madhusoodanan-0/+1
2025-05-06Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, ↵Stuart Cook-0/+2
r=jieyouxu,wesleywiser Implement RFC 3503: frontmatters Tracking issue: #136889 Supercedes #137193. This implements [RFC 3503](https://github.com/rust-lang/rfcs/blob/master/text/3503-frontmatter.md). This might break rust-analyzer. Will look into how to fix that. Suggestions welcome for how to improve diagnostics.
2025-05-05Implement RFC 3503: frontmattersDeadbeef-0/+2
Supercedes #137193
2025-05-04Initial support for dynamically linked cratesBryanskiy-0/+2
2025-05-04Rollup merge of #139675 - sayantn:avx10, r=AmanieuStuart Cook-0/+2
Add the AVX10 target features Parent #138843 Adds the `avx10_target_feature` feature gate, and `avx10.1` and `avx10.2` target features. It is confirmed that Intel is dropping AVX10/256 (see [this comment](https://github.com/rust-lang/rust/issues/111137#issuecomment-2795442288)), so this should be safe to implement now. The LLVM fix for llvm/llvm-project#135394 was merged, and has been backported to LLVM20, and the patch has also been propagated to rustc in #140502 `@rustbot` label O-x86_64 O-x86_32 A-target-feature A-SIMD
2025-04-28Rollup merge of #140323 - tgross35:cfg-unstable-float, r=UrgauChris Denton-0/+2
Implement the internal feature `cfg_target_has_reliable_f16_f128` Support for `f16` and `f128` is varied across targets, backends, and backend versions. Eventually we would like to reach a point where all backends support these approximately equally, but until then we have to work around some of these nuances of support being observable. Introduce the `cfg_target_has_reliable_f16_f128` internal feature, which provides the following new configuration gates: * `cfg(target_has_reliable_f16)` * `cfg(target_has_reliable_f16_math)` * `cfg(target_has_reliable_f128)` * `cfg(target_has_reliable_f128_math)` `reliable_f16` and `reliable_f128` indicate that basic arithmetic for the type works correctly. The `_math` versions indicate that anything relying on `libm` works correctly, since sometimes this hits a separate class of codegen bugs. These options match configuration set by the build script at [1]. The logic for LLVM support is duplicated as-is from the same script. There are a few possible updates that will come as a follow up. The config introduced here is not planned to ever become stable, it is only intended to replace the build scripts for `std` tests and `compiler-builtins` that don't have any way to configure based on the codegen backend. MCP: https://github.com/rust-lang/compiler-team/issues/866 Closes: https://github.com/rust-lang/compiler-team/issues/866 [1]: https://github.com/rust-lang/rust/blob/555e1d0386f024a8359645c3217f4b3eae9be042/library/std/build.rs#L84-L186 --- The second commit makes use of this config to replace `cfg_{f16,f128}{,_math}` in `library/`. I omitted providing a `cfg(bootstrap)` configuration to keep things simpler since the next beta branch is in two weeks. try-job: aarch64-gnu try-job: i686-msvc-1 try-job: test-various try-job: x86_64-gnu try-job: x86_64-msvc-ext2
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-0/+2
async_drop_in_place::{closure}, scoped async drop added.
2025-04-27Implement the internal feature `cfg_target_has_reliable_f16_f128`Trevor Gross-0/+2
Support for `f16` and `f128` is varied across targets, backends, and backend versions. Eventually we would like to reach a point where all backends support these approximately equally, but until then we have to work around some of these nuances of support being observable. Introduce the `cfg_target_has_reliable_f16_f128` internal feature, which provides the following new configuration gates: * `cfg(target_has_reliable_f16)` * `cfg(target_has_reliable_f16_math)` * `cfg(target_has_reliable_f128)` * `cfg(target_has_reliable_f128_math)` `reliable_f16` and `reliable_f128` indicate that basic arithmetic for the type works correctly. The `_math` versions indicate that anything relying on `libm` works correctly, since sometimes this hits a separate class of codegen bugs. These options match configuration set by the build script at [1]. The logic for LLVM support is duplicated as-is from the same script. There are a few possible updates that will come as a follow up. The config introduced here is not planned to ever become stable, it is only intended to replace the build scripts for `std` tests and `compiler-builtins` that don't have any way to configure based on the codegen backend. MCP: https://github.com/rust-lang/compiler-team/issues/866 Closes: https://github.com/rust-lang/compiler-team/issues/866 [1]: https://github.com/rust-lang/rust/blob/555e1d0386f024a8359645c3217f4b3eae9be042/library/std/build.rs#L84-L186
2025-04-26Add the `avx10.1` and `avx10.2` target featuressayantn-0/+2
2025-04-20stabilize `naked_functions`Folkert de Vries-2/+0
2025-04-17Auto merge of #139949 - matthiaskrgr:rollup-pxc5tsx, r=matthiaskrgrbors-2/+0
Rollup of 8 pull requests Successful merges: - #138632 (Stabilize `cfg_boolean_literals`) - #139416 (unstable book; document `macro_metavar_expr_concat`) - #139782 (Consistent with treating Ctor Call as Struct in liveness analysis) - #139885 (document RUSTC_BOOTSTRAP, RUSTC_OVERRIDE_VERSION_STRING, and -Z allow-features in the unstable book) - #139904 (Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` tests) - #139932 (transmutability: Refactor tests for simplicity) - #139944 (Move eager translation to a method on Diag) - #139948 (git: ignore `60600a6fa403216bfd66e04f948b1822f6450af7` for blame purposes) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-17Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, ↵Matthias Krüger-2/+0
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-15Add `explicit_extern_abis` unstable featureObei Sideg-0/+2
also add `explicit-extern-abis` feature section to the unstable book.
2025-04-13Rollup merge of #139001 - folkertdev:naked-function-rustic-abi, ↵Jacob Pratt-0/+2
r=traviscross,compiler-errors add `naked_functions_rustic_abi` feature gate tracking issue: https://github.com/rust-lang/rust/issues/138997 Because the details of the rust abi are unstable, and a naked function must match its stated ABI, this feature gate keeps naked functions with a rustic abi ("Rust", "rust-cold", "rust-call" and "rust-intrinsic") unstable. r? ````@traviscross````
2025-04-09replace version placeholderBoxy-5/+5
2025-04-07Add `naked_functions_rustic_abi` feature gateFolkert de Vries-0/+2
2025-04-07Rollup merge of #139455 - Skgland:remove_rust-intrinsic_ABI, r=oli-obkStuart Cook-1/+1
Remove support for `extern "rust-intrinsic"` blocks Part of rust-lang/rust#132735 Looked manageable and there didn't appear to have been progress in the last two weeks, so decided to give it a try.
2025-04-06update docsBennet Bleßmann-1/+1
- src\doc\nomicon\src\ffi.md should also have its ABI list updated
2025-04-04fixup! Implement `super let`.Mara Bos-1/+1
2025-04-03Stabilize `cfg_boolean_literals`clubby789-2/+0
2025-04-03Rollup merge of #139080 - m-ou-se:super-let-gate, r=traviscrossMatthias Krüger-0/+2
Experimental feature gate for `super let` This adds an experimental feature gate, `#![feature(super_let)]`, for the `super let` experiment. Tracking issue: https://github.com/rust-lang/rust/issues/139076 Liaison: ``@nikomatsakis`` ## Description There's a rough (inaccurate) description here: https://blog.m-ou.se/super-let/ In short, `super let` allows you to define something that lives long enough to be borrowed by the tail expression of the block. For example: ```rust let a = { super let b = temp(); &b }; ``` Here, `b` is extended to live as long as `a`, similar to how in `let a = &temp();`, the temporary will be extended to live as long as `a`. ## Properties During the temporary lifetimes work we did last year, we explored the properties of "super let" and concluded that the fundamental property should be that these two are always equivalent in any context: 1. `& $expr` 2. `{ super let a = & $expr; a }` And, additionally, that these are equivalent in any context when `$expr` is a temporary (aka rvalue): 1. `& $expr` 2. `{ super let a = $expr; & a }` This makes it possible to give a name to a temporary without affecting how temporary lifetimes work, such that a macro can transparently use a block in its expansion, without that having any effect on the outside. ## Implementing pin!() correctly With `super let`, we can properly implement the `pin!()` macro without hacks: :sparkles: ```rust pub macro pin($value:expr $(,)?) { { super let mut pinned = $value; unsafe { $crate::pin::Pin::new_unchecked(&mut pinned) } } } ``` This is important, as there is currently no way to express it without hacks in Rust 2021 and before (see [hacky definition](https://github.com/rust-lang/rust/blob/2a06022951893fe5b5384f8dbd75b4e6e3b5cee0/library/core/src/pin.rs#L1947)), and no way to express it at all in Rust 2024 (see [issue](https://github.com/rust-lang/rust/issues/138718)). ## Fixing format_args!() This will also allow us to express `format_args!()` in a way where one can assign the result to a variable, fixing a [long standing issue](https://github.com/rust-lang/rust/issues/92698): ```rust let f = format_args!("Hello {name}!"); // error today, but accepted in the future! (after separate FCP) ``` ## Experiment The precise definition of `super let`, what happens for `super let x;` (without initializer), and whether to accept `super let _ = _ else { .. }` are still open questions, to be answered by the experiment. Furthermore, once we have a more complete understanding of the feature, we might be able to come up with a better syntax. (Which could be just a different keywords, or an entirely different way of naming temporaries that doesn't involve a block and a (super) let statement.)
2025-04-02Mark super_let feature as incomplete.Mara Bos-1/+1
Co-authored-by: Travis Cross <tc@traviscross.com>
2025-04-02Rollup merge of #138003 - sayantn:new-amx, r=AmanieuStuart Cook-0/+1
Add the new `amx` target features and the `movrs` target feature Adds 5 new `amx` target features included in LLVM20. These are guarded under `x86_amx_intrinsics` (#126622) - `amx-avx512` - `amx-fp8` - `amx-movrs` - `amx-tf32` - `amx-transpose` Adds the `movrs` target feature (from #137976). `@rustbot` label O-x86_64 O-x86_32 T-compiler A-target-feature r? `@Amanieu`
2025-04-01Auto merge of #138492 - lcnr:rm-inline_const_pat, r=oli-obkbors-2/+0
remove `feature(inline_const_pat)` Summarizing https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/remove.20feature.28inline_const_pat.29.20and.20shared.20borrowck. With https://github.com/rust-lang/types-team/issues/129 we will start to borrowck items together with their typeck parent. This is necessary to correctly support opaque types, blocking the new solver and TAIT/ATPIT stabilization with the old one. This means that we cannot really support `inline_const_pat` as they are implemented right now: - we want to typeck inline consts together with their parent body to allow inference to flow both ways and to allow the const to refer to local regions of its parent.This means we also need to borrowck the inline const together with its parent as that's necessary to properly support opaque types - we want the inline const pattern to participate in exhaustiveness checking - to participate in exhaustiveness checking we need to evaluate it, which requires borrowck, which now relies on borrowck of the typeck root, which ends up checking exhaustiveness again. **This is a query cycle**. There are 4 possible ways to handle this: - stop typechecking inline const patterns together with their parent - causes inline const patterns to be different than inline const exprs - prevents bidirectional inference, we need to either fail to compile `if let const { 1 } = 1u32` or `if let const { 1u32 } = 1` - region inference for inline consts will be harder, it feels non-trivial to support inline consts referencing local regions from the parent fn - inline consts no longer participate in exhaustiveness checking. Treat them like `pat if pat == const { .. }` instead. We then only evaluate them after borrowck - difference between `const { 1 }` and `const FOO: usize = 1; match x { FOO => () }`. This is confusing - do they carry their weight if they are now just equivalent to using an if-guard - delay exhaustiveness checking until after borrowck - should be possible in theory, but is a quite involved change and may have some unexpected challenges - remove this feature for now I believe we should either delay exhaustiveness checking or remove the feature entirely. As moving exhaustiveness checking to after borrow checking is quite complex I think the right course of action is to fully remove the feature for now and to add it again once/if we've got that implementation figured out. `const { .. }`-expressions remain stable. These seem to have been the main motivation for https://github.com/rust-lang/rfcs/issues/2920. r? types cc `@rust-lang/types` `@rust-lang/lang` #76001
2025-03-28Add the feature gate for the `super let` experiment.Mara Bos-0/+2
2025-03-23Stabilize precise_capturing_in_traitsMichael Goulet-2/+0
2025-03-21Rollup merge of #138570 - folkertdev:naked-function-target-feature-gate, ↵Matthias Krüger-0/+2
r=Amanieu add `naked_functions_target_feature` unstable feature tracking issue: https://github.com/rust-lang/rust/issues/138568 tagging https://github.com/rust-lang/rust/pull/134213 https://github.com/rust-lang/rust/issues/90957 This PR puts `#[target_feature(/* ... */)]` on `#[naked]` functions behind its own feature gate, so that naked functions can be stabilized. It turns out that supporting `target_feature` on naked functions is tricky on some targets, so we're splitting it out to not block stabilization of naked functions themselves. See the tracking issue for more information and workarounds. Note that at the time of writing, the `target_features` attribute is ignored when generating code for naked functions. r? ``@Amanieu``
2025-03-21remove `feature(inline_const_pat)`lcnr-2/+0
2025-03-17Stabilize asm_gotoGary Guo-2/+0
2025-03-16add `naked_functions_target_feature` unstable featureFolkert de Vries-0/+2
2025-03-10add tracking issue for unqualified_local_importsRalf Jung-1/+1
2025-03-07Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakisMatthias Krüger-0/+2
Ergonomic ref counting This is an experimental first version of ergonomic ref counting. This first version implements most of the RFC but doesn't implement any of the optimizations. This was left for following iterations. RFC: https://github.com/rust-lang/rfcs/pull/3680 Tracking issue: https://github.com/rust-lang/rust/issues/132290 Project goal: https://github.com/rust-lang/rust-project-goals/issues/107 r? ```@nikomatsakis```
2025-03-06Make feature flag incompleteSantiago Pastorino-1/+1
2025-03-06Add ergonomic_clones feature flagSantiago Pastorino-0/+2
2025-03-06Rollup merge of #138081 - eholk:yield-feature, r=oli-obkMichael Goulet-0/+1
Move `yield` expressions behind their own feature gate In order to make progress with the `iter!` macro (e.g. in #137725), we need `yield` expressions to be available without the `coroutines` feature. This PR moves `yield` to be guarded by the `yield_expr` feature so that we can stabilize that independently (or at least, concurrently with the `iter_macro` feature). Note that once `yield` is stable, it will still be an error to use `yield` expressions outside something like a generator or coroutine, and these features remain unstable. r? `@oli-obk`
2025-03-06Rollup merge of #137827 - yaahc:timestamp-metrics, r=estebankMichael Goulet-1/+15
Add timestamp to unstable feature usage metrics part of https://github.com/rust-lang/rust/issues/129485 with this we should be able to temporarily enable metrics on docs.rs to gather a nice test dataset for the initial PoC dashboard r? ```@estebank```
2025-03-06Add the yield_expr featureEric Holk-0/+1
2025-03-05Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk许杰友 Jieyou Xu (Joe)-2/+0
Remove unsizing coercions for tuples See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification. Tracking issue: #42877 Fixes: #135217
2025-03-05Add the `movrs` target feature and `movrs_target_feature` feature gatesayantn-0/+1
2025-03-04Auto merge of #135695 - Noratrieb:elf-raw-dylib, r=bjorn3bors-0/+2
Support raw-dylib link kind on ELF raw-dylib is a link kind that allows rustc to link against a library without having any library files present. This currently only exists on Windows. rustc will take all the symbols from raw-dylib link blocks and put them in an import library, where they can then be resolved by the linker. While import libraries don't exist on ELF, it would still be convenient to have this same functionality. Not having the libraries present at build-time can be convenient for several reasons, especially cross-compilation. With raw-dylib, code linking against a library can be cross-compiled without needing to have these libraries available on the build machine. If the libc crate makes use of this, it would allow cross-compilation without having any libc available on the build machine. This is not yet possible with this implementation, at least against libc's like glibc that use symbol versioning. The raw-dylib kind could be extended with support for symbol versioning in the future. This implementation is very experimental and I have not tested it very well. I have tested it for a toy example and the lz4-sys crate, where it was able to successfully link a binary despite not having a corresponding library at build-time. I was inspired by Björn's comments in https://internals.rust-lang.org/t/bundle-zig-cc-in-rustup-by-default/22096/27 Tracking issue: #135694 r? bjorn3 try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-03-03Add timestamp to unstable feature usage metricsJane Losare-Lusby-1/+15
2025-03-03Rollup merge of #132388 - frank-king:feature/where-cfg, r=petrochenkovMatthias Krüger-0/+2
Implement `#[cfg]` in `where` clauses This PR implements #115590, which supports `#[cfg]` attributes in `where` clauses. The biggest change is, that it adds `AttrsVec` and `NodeId` to the `ast::WherePredicate` and `HirId` to the `hir::WherePredicate`.
2025-03-01Implment `#[cfg]` and `#[cfg_attr]` in `where` clausesFrank King-0/+2
2025-02-28Introduce `feature(generic_const_parameter_types)`Boxy-0/+2
2025-02-27Delete tuple unsizingAlice Ryhl-2/+0
2025-02-26Support raw-dylib link kind on ELFNoratrieb-0/+2
raw-dylib is a link kind that allows rustc to link against a library without having any library files present. This currently only exists on Windows. rustc will take all the symbols from raw-dylib link blocks and put them in an import library, where they can then be resolved by the linker. While import libraries don't exist on ELF, it would still be convenient to have this same functionality. Not having the libraries present at build-time can be convenient for several reasons, especially cross-compilation. With raw-dylib, code linking against a library can be cross-compiled without needing to have these libraries available on the build machine. If the libc crate makes use of this, it would allow cross-compilation without having any libc available on the build machine. This is not yet possible with this implementation, at least against libc's like glibc that use symbol versioning. The raw-dylib kind could be extended with support for symbol versioning in the future. This implementation is very experimental and I have not tested it very well. I have tested it for a toy example and the lz4-sys crate, where it was able to successfully link a binary despite not having a corresponding library at build-time.