File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 32
32
- [ ` dyn Trait ` for trait objects] ( rust-2018/trait-system/dyn-trait-for-trait-objects.md )
33
33
- [ More container types support trait objects] ( rust-2018/trait-system/more-container-types-support-trait-objects.md )
34
34
- [ Associated constants] ( rust-2018/trait-system/associated-constants.md )
35
+ - [ No more anonymous parameters] ( rust-2018/trait-system/no-anon-params.md )
35
36
- [ Slice patterns] ( rust-2018/slice-patterns.md )
36
37
- [ Ownership and lifetimes] ( rust-2018/ownership-and-lifetimes/index.md )
37
38
- [ Default ` match ` bindings] ( rust-2018/ownership-and-lifetimes/default-match-bindings.md )
Original file line number Diff line number Diff line change
1
+ # No more anonymous trait parameters
2
+
3
+ In accordance with RFC [ #1685 ] ( https://github.com/rust-lang/rfcs/pull/1685 ) ,
4
+ parameters in trait method declarations are no longer allowed to be anonymous.
5
+
6
+ For example, in the 2015 edition, this was allowed:
7
+ ``` rust
8
+ trait Foo {
9
+ fn foo (& self , u8 );
10
+ }
11
+ ```
12
+
13
+ In the 2018 edition, all parameters must be given an argument name (even if it's just
14
+ ` _ ` ):
15
+
16
+ ``` rust
17
+ trait Foo {
18
+ fn foo (& self , baz : u8 );
19
+ }
20
+ ```
You can’t perform that action at this time.
0 commit comments