Identify missing item category in impls
```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
```
This commit is contained in:
parent
c62e532f3d
commit
57009caabd
3 changed files with 80 additions and 15 deletions
21
src/test/ui/did_you_mean/issue-40006.rs
Normal file
21
src/test/ui/did_you_mean/issue-40006.rs
Normal file
|
|
@ -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();
|
||||
}
|
||||
12
src/test/ui/did_you_mean/issue-40006.stderr
Normal file
12
src/test/ui/did_you_mean/issue-40006.stderr
Normal file
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue