about summary refs log tree commit diff
path: root/compiler/rustc_feature/src
AgeCommit message (Collapse)AuthorLines
2023-03-31Auto merge of #109824 - GuillaumeGomez:rollup-i5r4uts, r=GuillaumeGomezbors-1/+5
Rollup of 7 pull requests Successful merges: - #109104 (rustdoc: Fix invalid suggestions on ambiguous intra doc links v2) - #109443 (Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`) - #109680 (Fix subslice capture in closure) - #109798 (fluent_messages macro: don't emit the OS error in a note) - #109805 (Source map cleanups) - #109818 (rustdoc: Add GUI test for jump to collapsed item) - #109820 (rustdoc-search: update docs for comma in `?` help popover) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-31Auto merge of #109010 - compiler-errors:rtn, r=eholkbors-0/+2
Initial support for return type notation (RTN) See: https://smallcultfollowing.com/babysteps/blog/2023/02/13/return-type-notation-send-bounds-part-2/ 1. Only supports `T: Trait<method(): Send>` style bounds, not `<T as Trait>::method(): Send`. Checking validity and injecting an implicit binder for all of the late-bound method generics is harder to do for the latter. * I'd add this in a follow-up. 3. ~Doesn't support RTN in general type position, i.e. no `let x: <T as Trait>::method() = ...`~ * I don't think we actually want this. 5. Doesn't add syntax for "eliding" the function args -- i.e. for now, we write `method(): Send` instead of `method(..): Send`. * May be a hazard if we try to add it in the future. I'll probably add it in a follow-up later, with a structured suggestion to change `method()` to `method(..)` once we add it. 7. ~I'm not in love with the feature gate name 😺~ * I renamed it to `return_type_notation` :heavy_check_mark: Follow-up PRs will probably add support for `where T::method(): Send` bounds. I'm not sure if we ever want to support return-type-notation in arbitrary type positions. I may also make the bounds require `..` in the args list later. r? `@ghost`
2023-03-30Rename doc(primitive) into rustc_doc_primitiveGuillaume Gomez-1/+5
2023-03-29Stabilize a portion of 'once_cell'Trevor Gross-1/+1
Move items not part of this stabilization to 'lazy_cell' or 'once_cell_try'
2023-03-28Feature gateMichael Goulet-0/+2
2023-03-23Rollup merge of #108549 - clubby789:fix-link-cfg-issue, r=eholkMatthias Krüger-2/+2
Remove issue number for `link_cfg` Fixes #72059 Per #37406 and its [unstable book entry](https://doc.rust-lang.org/beta/unstable-book/language-features/link-cfg.html), this is an internal feature, and therefore perma-unstable and not being tracked
2023-03-15Bump version placeholdersMark Rousskov-4/+4
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-2/+2
2023-03-02Stabilize movbe target featureCaleb Zulawski-2/+3
2023-03-02Revert "Stabilize `#![feature(target_feature_11)]`"Léo Lanteri Thauvin-2/+2
This reverts commit b379d216eefaba083a0627b1724d73f99d4bdf5c.
2023-03-01Rollup merge of #108550 - clubby789:remove-disjoint, r=compiler-errorsMatthias Krüger-2/+2
Remove the `capture_disjoint_fields` feature As best I can tell, this was stabilized for Edition 2021 in #88126 but the feature was never removed.
2023-02-28Auto merge of #106774 - Nugine:master, r=Amanieubors-1/+2
Stabilize cmpxchg16b_target_feature Tracking issue for target features + #44839 stdarch issue + https://github.com/rust-lang/stdarch/issues/827 stdarch PR + https://github.com/rust-lang/stdarch/pull/1358 reference PR + https://github.com/rust-lang/reference/pull/1331 It's my first time contributing to rust-lang/rust. Please tell me if I missed something.
2023-02-28Remove the `capture_disjoint_fields` featureclubby789-2/+2
2023-02-28Auto merge of #99767 - LeSeulArtichaut:stable-target-feature-11, r=estebankbors-2/+2
Stabilize `#![feature(target_feature_11)]` ## Stabilization report ### 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 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(); } ``` ### Test cases Tests for this feature can be found in [`src/test/ui/rfcs/rfc-2396-target_feature-11/`](https://github.com/rust-lang/rust/tree/b67ba9ba208ac918228a18321fc3a11a99b1c62b/src/test/ui/rfcs/rfc-2396-target_feature-11/). ### Edge cases - 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 show that the target-feature is available while the function executes *and* for as long as whatever may escape from that function lives. ### Documentation - Reference: https://github.com/rust-lang/reference/pull/1181 --- cc tracking issue #69098 r? `@ghost`
2023-02-28Remove issue number for `link_cfg`clubby789-2/+2
2023-02-18Adjust tracking issue for non_lifetime_bindersMichael Goulet-1/+1
2023-02-17Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillotMatthias Krüger-0/+2
Implement partial support for non-lifetime binders This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed. Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged. Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`) cc rust-lang/types-team#81 r? `@ghost`
2023-02-16note issue for feature(packed_bundled_libs)BelovDV-2/+2
2023-02-16Add feature gate for non_lifetime_bindersMichael Goulet-0/+2
2023-02-14change the `marker` attribute to only_locallcnr-2/+6
2023-02-14add a `#[rustc_coinductive]` attributelcnr-2/+5
2023-02-10[link] enable packed bundled lib in non stable casesDaniil Belov-0/+2
2023-02-01Stabilize `#![feature(target_feature_11)]`Léo Lanteri Thauvin-2/+2
2023-02-01Stabilize cmpxchg16b_target_featureNugine-1/+2
2023-01-31Auto merge of #107297 - Mark-Simulacrum:bump-bootstrap, r=pietroalbinibors-4/+4
Bump bootstrap compiler to 1.68 This also changes our stage0.json to include the rustc component for the rustfmt pinned nightly toolchain, which is currently necessary due to rustfmt dynamically linking to that toolchain's librustc_driver and libstd. r? `@pietroalbini`
2023-01-28Reintroduce multiple_supertrait_upcastable lintGary Guo-0/+2
2023-01-25Set version placeholders to 1.68Mark Rousskov-4/+4
2023-01-25Rollup merge of #106767 - chbaker0:disable-unstable-features, r=Mark-SimulacrumDylan DPC-1/+2
Allow setting CFG_DISABLE_UNSTABLE_FEATURES to 0 Two locations check whether this build-time environment variable is defined. Allowing it to be explicitly disabled with a "0" value is useful, especially for integrating with external build systems.
2023-01-13Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obkbors-1/+3
Const closures cc https://github.com/rust-lang/rust/issues/106003
2023-01-13Rollup merge of #105795 - nicholasbishop:bishop-stabilize-efiapi, r=joshtriplettYuki Okushi-2/+2
Stabilize `abi_efiapi` feature Tracking issue: https://github.com/rust-lang/rust/issues/65815 Closes #65815
2023-01-12Allow setting CFG_DISABLE_UNSTABLE_FEATURES to 0Collin Baker-1/+2
Two locations check whether this build-time environment variable is defined. Allowing it to be explicitly disabled with a "0" value is useful, especially for integrating with external build systems.
2023-01-11Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, ↵Michael Goulet-1/+2
r=petrochenkov Stabilize f16c_target_feature Resolves https://github.com/rust-lang/stdarch/issues/1234 Library PR for stabilizing corresponding intrinsics: https://github.com/rust-lang/stdarch/pull/1366 See also #44839 tracking issue for target_feature
2023-01-12gate const closuresDeadbeef-1/+3
2023-01-11Stabilize `abi_efiapi` featureNicholas Bishop-2/+2
Tracking issue: https://github.com/rust-lang/rust/issues/65815
2023-01-09[RFC 2397] Initial implementationCaio-0/+5
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-2/+2
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-01Use the correct tracking issue for `dyn_star`Léo Lanteri Thauvin-1/+1
2022-12-30Stabilize f16c_target_featureKathryn Long-1/+2
2022-12-29Revert "Implement allow-by-default multiple_supertrait_upcastable lint"David Tolnay-2/+0
This reverts commit 5e44a65517bfcccbe6624a70b54b9f192baa94f3.
2022-12-28update stabilization version numbersPietro Albini-4/+4
2022-12-28Rollup merge of #105484 - nbdd0121:upcast, r=compiler-errorsfee1-dead-0/+2
Implement allow-by-default `multiple_supertrait_upcastable` lint The lint detects when an object-safe trait has multiple supertraits. Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them. r? `@nikomatsakis`
2022-12-16Auto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obkbors-2/+2
Stabilize default_alloc_error_handler Tracking issue: #66741 This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided. The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked. Closes #66741
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-1/+1
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-09Implement allow-by-default multiple_supertrait_upcastable lintGary Guo-0/+2
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-1/+1
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-11-27Stabilize native library modifier `verbatim`Vadim Petrochenkov-2/+2
2022-11-21Auto merge of #103491 - cjgillot:self-rpit, r=oli-obkbors-0/+2
Support using `Self` or projections inside an RPIT/async fn I reuse the same idea as https://github.com/rust-lang/rust/pull/103449 to use variances to encode whether a lifetime parameter is captured by impl-trait. The current implementation of async and RPIT replace all lifetimes from the parent generics by `'static`. This PR changes the scheme ```rust impl<'a> Foo<'a> { fn foo<'b, T>() -> impl Into<Self> + 'b { ... } } opaque Foo::<'_a>::foo::<'_b, T>::opaque<'b>: Into<Foo<'_a>> + 'b; impl<'a> Foo<'a> { // OLD fn foo<'b, T>() -> Foo::<'static>::foo::<'static, T>::opaque::<'b> { ... } ^^^^^^^ the `Self` becomes `Foo<'static>` // NEW fn foo<'b, T>() -> Foo::<'a>::foo::<'b, T>::opaque::<'b> { ... } ^^ the `Self` stays `Foo<'a>` } ``` There is the same issue with projections. In the example, substitute `Self` by `<T as Trait<'b>>::Assoc` in the sugared version, and `Foo<'_a>` by `<T as Trait<'_b>>::Assoc` in the desugared one. This allows to support `Self` in impl-trait, since we do not replace lifetimes by `'static` any more. The same trick allows to use projections like `T::Assoc` where `Self` is allowed. The feature is gated behind a `impl_trait_projections` feature gate. The implementation relies on 2 tweaking rules for opaques in 2 places: - we only relate substs that correspond to captured lifetimes during TypeRelation; - we only list captured lifetimes in choice region computation. For simplicity, I encoded the "capturedness" of lifetimes as a variance, `Bivariant` vs `Invariant` for unused vs captured lifetimes. The `variances_of` query used to ICE for opaques. Impl-trait that do not reference `Self` or projections will have their variances as: - `o` (invariant) for each parent type or const; - `*` (bivariant) for each parent lifetime --> will not participate in borrowck; - `o` (invariant) for each own lifetime. Impl-trait that does reference `Self` and/or projections will have some parent lifetimes marked as `o` (as the example above), and participate in type relation and borrowck. In the example above, `variances_of(opaque) = ['_a: o, '_b: *, T: o, 'b: o]`. r? types cc `@compiler-errors` , as you asked about the issue with `Self` and projections.
2022-11-18rename to `string_deref_patterns`Deadbeef-2/+2
2022-11-17Add feature gateDeadbeef-0/+2
2022-11-15Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillotMatthias Krüger-0/+4
Add `rustc_deny_explicit_impl` Also adjust `E0322` error message to be more general, since it's used for `DiscriminantKind` and `Pointee` as well. Also add `rustc_deny_explicit_impl` on the `Tuple` and `Destruct` marker traits.