rust/compiler/rustc_middle/src/middle
Dylan DPC 1dc4858914
Rollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011
Implement `#[rustc_default_body_unstable]`

This PR implements a new stability attribute — `#[rustc_default_body_unstable]`.

`#[rustc_default_body_unstable]` controls the stability of default bodies in traits.
For example:
```rust
pub trait Trait {
    #[rustc_default_body_unstable(feature = "feat", isssue = "none")]
    fn item() {}
}
```
In order to implement `Trait` user needs to either
- implement `item` (even though it has a default implementation)
- enable `#![feature(feat)]`

This is useful in conjunction with [`#[rustc_must_implement_one_of]`](https://github.com/rust-lang/rust/pull/92164), we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way — making implementation of only `PartialEq::ne` unstable.

r? `@Aaron1011`
cc `@nrc` (iirc you were interested in this wrt `read_buf`), `@danielhenrymantilla` (you were interested in the related `#[rustc_must_implement_one_of]`)
P.S. This is my first time working with stability attributes, so I'm not sure if I did everything right 😅
2022-08-09 17:34:50 +05:30
..
codegen_fn_attrs.rs codegen: use new {re,de,}allocator annotations in llvm 2022-07-26 09:43:28 -04:00
dependency_format.rs
exported_symbols.rs Synthesis object file for #[used] and exported symbols 2022-04-18 20:50:56 +01:00
lang_items.rs
limits.rs Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
mod.rs passes: check implied feature exists 2022-07-20 15:50:59 +01:00
privacy.rs
region.rs Replace &Vec<_>s with &[_]s 2022-06-03 20:42:42 +04:00
resolve_lifetime.rs Stop creating anonymous late lifetimes. 2022-07-26 19:00:31 +02:00
stability.rs Move stability lookup after cross-crate check 2022-08-05 18:13:22 +04:00