Skip to content

Commit 01b0001

Browse files
authored
Merge pull request #105 from mark-i-m/anon_params
Document deprecation of anon params
2 parents 9ca9963 + e6437a7 commit 01b0001

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- [`dyn Trait` for trait objects](rust-2018/trait-system/dyn-trait-for-trait-objects.md)
3333
- [More container types support trait objects](rust-2018/trait-system/more-container-types-support-trait-objects.md)
3434
- [Associated constants](rust-2018/trait-system/associated-constants.md)
35+
- [No more anonymous parameters](rust-2018/trait-system/no-anon-params.md)
3536
- [Slice patterns](rust-2018/slice-patterns.md)
3637
- [Ownership and lifetimes](rust-2018/ownership-and-lifetimes/index.md)
3738
- [Default `match` bindings](rust-2018/ownership-and-lifetimes/default-match-bindings.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
```

0 commit comments

Comments
 (0)