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..757ffddc --- /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 an argument name (even if it's just +`_`): + +```rust +trait Foo { + fn foo(&self, baz: u8); +} +```