diff options
| author | bors <bors@rust-lang.org> | 2023-11-23 15:05:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-23 15:05:55 +0000 |
| commit | 237339fda17395d3e35f3028a0e0aa8278c3a4bf (patch) | |
| tree | 81d701ee47e33cdc7d6e0b547acbbddf1c38a3f7 | |
| parent | 91f7f266ce973a08e6e700f9ce815f7b61d347e9 (diff) | |
| parent | edf6c9c223d465b730e3f1baa45316053e74618b (diff) | |
| download | rust-237339fda17395d3e35f3028a0e0aa8278c3a4bf.tar.gz rust-237339fda17395d3e35f3028a0e0aa8278c3a4bf.zip | |
Auto merge of #117978 - petrochenkov:deleggate, r=TaKO8Ki,joshtriplett
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. TODO: find a lang team liaison - https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/fn.20delegation.20liaison/near/402506959.
| -rw-r--r-- | compiler/rustc_feature/src/unstable.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 1 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-fn_delegation.rs | 3 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-fn_delegation.stderr | 13 |
4 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 35726ba52bc..e34661d5fc6 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -456,6 +456,8 @@ declare_features! ( (unstable, ffi_returns_twice, "1.34.0", Some(58314), None), /// Allows using `#[repr(align(...))]` on function items (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`. (unstable, gen_blocks, "1.75.0", Some(117078), None), /// Infer generic args for both consts and types. diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ea80bc82bd1..40b03874242 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -787,6 +787,7 @@ symbols! { fmt, fmul_fast, fn_align, + fn_delegation, fn_must_use, fn_mut, fn_once, diff --git a/tests/ui/feature-gates/feature-gate-fn_delegation.rs b/tests/ui/feature-gates/feature-gate-fn_delegation.rs new file mode 100644 index 00000000000..6ac36712090 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-fn_delegation.rs @@ -0,0 +1,3 @@ +todo!(); //~ ERROR + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-fn_delegation.stderr b/tests/ui/feature-gates/feature-gate-fn_delegation.stderr new file mode 100644 index 00000000000..1f55c1f250a --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-fn_delegation.stderr @@ -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 + |
