From 87f485c5dc7aaa24fac883e04577e4b48b01fda2 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Mon, 17 Sep 2018 18:11:31 -0500 Subject: [PATCH 1/2] document deprecation of anon params --- src/SUMMARY.md | 1 + src/rust-2018/trait-system/no-anon-params.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/rust-2018/trait-system/no-anon-params.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index fb3ecc4a..e0ad5394 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -32,6 +32,7 @@ - [`dyn Trait` for trait objects](rust-2018/trait-system/dyn-trait-for-trait-objects.md) - [More container types support trait objects](rust-2018/trait-system/more-container-types-support-trait-objects.md) - [Associated constants](rust-2018/trait-system/associated-constants.md) + - [No more anonymous parameters](rust-2018/trait-system/no-anon-params.md) - [Slice patterns](rust-2018/slice-patterns.md) - [Ownership and lifetimes](rust-2018/ownership-and-lifetimes/index.md) - [Default `match` bindings](rust-2018/ownership-and-lifetimes/default-match-bindings.md) diff --git a/src/rust-2018/trait-system/no-anon-params.md b/src/rust-2018/trait-system/no-anon-params.md new file mode 100644 index 00000000..bbe8c76a --- /dev/null +++ b/src/rust-2018/trait-system/no-anon-params.md @@ -0,0 +1,20 @@ +# No more anonymous trait parameters + +In accordance with RFC [#1685](https://github.com/rust-lang/rfcs/pull/1685), +parameters in trait method declarations are no longer allowed to be anonymous. + +For example, in the 2015 edition, this was allowed: +```rust +trait Foo { + fn foo(&self, u8); +} +``` + +In the 2018 edition, all parameters must be given a variable (even if it's just +`_`): + +```rust +trait Foo { + fn foo(&self, baz: u8); +} +``` From e6437a76e6f0d6820a64826f73ba50d3b1450883 Mon Sep 17 00:00:00 2001 From: Who? Me?! Date: Mon, 17 Sep 2018 23:04:40 -0500 Subject: [PATCH 2/2] Centril suggestionn --- src/rust-2018/trait-system/no-anon-params.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust-2018/trait-system/no-anon-params.md b/src/rust-2018/trait-system/no-anon-params.md index bbe8c76a..757ffddc 100644 --- a/src/rust-2018/trait-system/no-anon-params.md +++ b/src/rust-2018/trait-system/no-anon-params.md @@ -10,7 +10,7 @@ trait Foo { } ``` -In the 2018 edition, all parameters must be given a variable (even if it's just +In the 2018 edition, all parameters must be given an argument name (even if it's just `_`): ```rust