Account for missing keyword in fn/struct definition
This commit is contained in:
parent
1737d69c3b
commit
547873aa54
5 changed files with 106 additions and 1 deletions
15
src/test/ui/suggestions/pub-ident-fn.rs
Normal file
15
src/test/ui/suggestions/pub-ident-fn.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// 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.
|
||||
|
||||
pub foo(s: usize) -> bool { true }
|
||||
|
||||
fn main() {
|
||||
foo(2);
|
||||
}
|
||||
13
src/test/ui/suggestions/pub-ident-fn.stderr
Normal file
13
src/test/ui/suggestions/pub-ident-fn.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error: missing `fn` for method definition
|
||||
--> $DIR/pub-ident-fn.rs:11:4
|
||||
|
|
||||
11 | pub foo(s: usize) -> bool { true }
|
||||
| ^^^
|
||||
|
|
||||
help: add `fn` here to parse `foo` as a public method
|
||||
|
|
||||
11 | pub fn foo(s: usize) -> bool { true }
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
13
src/test/ui/suggestions/pub-ident-struct.rs
Normal file
13
src/test/ui/suggestions/pub-ident-struct.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// 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.
|
||||
|
||||
pub S {
|
||||
}
|
||||
fn main() {}
|
||||
13
src/test/ui/suggestions/pub-ident-struct.stderr
Normal file
13
src/test/ui/suggestions/pub-ident-struct.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error: missing `struct` for struct definition
|
||||
--> $DIR/pub-ident-struct.rs:11:4
|
||||
|
|
||||
11 | pub S {
|
||||
| ^
|
||||
|
|
||||
help: add `struct` here to parse `S` as a public struct
|
||||
|
|
||||
11 | pub struct S {
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue