diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2017-03-24 23:00:21 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2017-03-24 23:06:00 -0700 |
| commit | 57009caabd2a45a6efa4d36149feec39ab0a0658 (patch) | |
| tree | fbf7cad105ada8a7db30f266ce8b6313eeb62174 /src/test | |
| parent | c62e532f3de4c0254b772c36fe629b2042efd107 (diff) | |
| download | rust-57009caabd2a45a6efa4d36149feec39ab0a0658.tar.gz rust-57009caabd2a45a6efa4d36149feec39ab0a0658.zip | |
Identify missing item category in `impl`s
```rust
struct S;
impl S {
pub hello_method(&self) {
println!("Hello");
}
}
fn main() { S.hello_method(); }
```
```rust
error: can't qualify macro invocation with `pub`
--> file.rs:3:4
|
3 | pub hello_method(&self) {
| ^^^- - expected `!` here for a macro invocation
| |
| did you mean to write `fn` here for a method declaration?
|
= help: try adjusting the macro to put `pub` inside the invocation
```
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/did_you_mean/issue-40006.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/issue-40006.stderr | 12 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs new file mode 100644 index 00000000000..cf75929bae2 --- /dev/null +++ b/src/test/ui/did_you_mean/issue-40006.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct S; + +impl S { + pub hello_method(&self) { + println!("Hello"); + } +} + +fn main() { + S.hello_method(); +} diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr new file mode 100644 index 00000000000..93a0c58f91a --- /dev/null +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -0,0 +1,12 @@ +error: can't qualify macro invocation with `pub` + --> $DIR/issue-40006.rs:14:5 + | +14 | pub hello_method(&self) { + | ^^^- - expected `!` here for a macro invocation + | | + | did you mean to write `fn` here for a method declaration? + | + = help: try adjusting the macro to put `pub` inside the invocation + +error: aborting due to previous error + |
