rust/compiler/rustc_expand/src
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
..
mbe Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
mut_visit rustc_ast: Turn MutVisitor::token_visiting_enabled into a constant 2021-10-18 00:23:24 +03:00
parse Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
tokenstream Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
base.rs Implement #[rustc_default_body_unstable] 2022-07-26 15:38:03 +04:00
build.rs Parse closure binders 2022-07-12 16:25:16 +04:00
config.rs Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov 2022-07-30 14:50:05 +00:00
expand.rs Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
lib.rs Auto merge of #99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors 2022-07-23 07:59:54 +00:00
mbe.rs Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
module.rs avoid some Symbol to String conversions 2022-07-17 04:09:20 +09:00
placeholders.rs Save colon span to suggest bounds. 2022-04-30 13:55:17 +02:00
proc_macro.rs Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov 2022-07-30 14:50:05 +00:00
proc_macro_server.rs Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
tests.rs avoid many &str to String conversions with MultiSpan::push_span_label 2022-06-29 21:16:43 +09:00