Add an experimental feature gate for function delegation

In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md).

Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530.
This commit is contained in:
Vadim Petrochenkov 2023-11-16 19:08:30 +03:00
parent e7b22851a2
commit edf6c9c223
4 changed files with 19 additions and 0 deletions

View File

@ -456,6 +456,8 @@ pub fn internal(&self, feature: Symbol) -> bool {
(unstable, ffi_returns_twice, "1.34.0", Some(58314), None), (unstable, ffi_returns_twice, "1.34.0", Some(58314), None),
/// Allows using `#[repr(align(...))]` on function items /// Allows using `#[repr(align(...))]` on function items
(unstable, fn_align, "1.53.0", Some(82232), None), (unstable, fn_align, "1.53.0", Some(82232), None),
/// Support delegating implementation of functions to other already implemented functions.
(incomplete, fn_delegation, "CURRENT_RUSTC_VERSION", Some(118212), None),
/// Allows defining gen blocks and `gen fn`. /// Allows defining gen blocks and `gen fn`.
(unstable, gen_blocks, "1.75.0", Some(117078), None), (unstable, gen_blocks, "1.75.0", Some(117078), None),
/// Infer generic args for both consts and types. /// Infer generic args for both consts and types.

View File

@ -787,6 +787,7 @@
fmt, fmt,
fmul_fast, fmul_fast,
fn_align, fn_align,
fn_delegation,
fn_must_use, fn_must_use,
fn_mut, fn_mut,
fn_once, fn_once,

View File

@ -0,0 +1,3 @@
todo!(); //~ ERROR
fn main() {}

View File

@ -0,0 +1,13 @@
error: expected one of `!` or `::`, found `(`
--> $DIR/feature-gate-fn_delegation.rs:1:1
|
LL | todo!();
| ^^^^^^^
| |
| expected one of `!` or `::`
| in this macro invocation
|
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error