diff options
| author | bors <bors@rust-lang.org> | 2016-10-29 05:41:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-29 05:41:05 -0700 |
| commit | 75a87c54d0d6a2fa0d5a576a2fa6e03ff23e5f03 (patch) | |
| tree | 7e925323526d1a3c01e51d56aeba905442e1d553 /src/doc/reference.md | |
| parent | 5db21c3af66ccd6d3c48d420a036c65e6f7711ed (diff) | |
| parent | 4ca11ce196d07206852a265d6a0546569de88912 (diff) | |
| download | rust-75a87c54d0d6a2fa0d5a576a2fa6e03ff23e5f03.tar.gz rust-75a87c54d0d6a2fa0d5a576a2fa6e03ff23e5f03.zip | |
Auto merge of #37378 - petrochenkov:nopat, r=eddyb
Prohibit patterns in trait methods without bodies
They are not properly type checked
```rust
trait Tr {
fn f(&a: u8); // <- This compiles
}
```
, mostly rejected by the parser already and generally don't make much sense.
This PR is kind of a missing part of https://github.com/rust-lang/rust/pull/35015.
Given the [statistics from crater](https://github.com/rust-lang/rust/pull/37378#issuecomment-256154994), the effect of this PR is mostly equivalent to improving `unused_mut` lint.
cc https://github.com/rust-lang/rust/issues/35078#issuecomment-255707355 https://github.com/rust-lang/rust/pull/35015 https://github.com/rust-lang/rfcs/pull/1685 https://github.com/rust-lang/rust/issues/35203
r? @eddyb
Diffstat (limited to 'src/doc/reference.md')
| -rw-r--r-- | src/doc/reference.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 80b60fbf0e3..4838ecd2d42 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -4023,9 +4023,9 @@ Methods that take either `self` or `Box<Self>` can optionally place them in a mutable variable by prefixing them with `mut` (similar to regular arguments): ``` -trait Changer { - fn change(mut self) -> Self; - fn modify(mut self: Box<Self>) -> Box<Self>; +trait Changer: Sized { + fn change(mut self) {} + fn modify(mut self: Box<Self>) {} } ``` |
