about summary refs log tree commit diff
path: root/tests/ui/pub
diff options
context:
space:
mode:
authortrevyn <230691+trevyn@users.noreply.github.com>2024-07-06 13:14:53 +0300
committertrevyn <230691+trevyn@users.noreply.github.com>2024-07-08 10:04:03 +0400
commitb40adc9d3b56f230f295011ff78b0dfd378683ef (patch)
treee488528d8378b67898faa6b30dd25a5f6ac88caf /tests/ui/pub
parent51917e2e69702e5752bce6a4f3bfd285d0f4ae39 (diff)
downloadrust-b40adc9d3b56f230f295011ff78b0dfd378683ef.tar.gz
rust-b40adc9d3b56f230f295011ff78b0dfd378683ef.zip
Add suggestions for possible missing `fn`, `struct`, or `enum` keywords
Diffstat (limited to 'tests/ui/pub')
-rw-r--r--tests/ui/pub/pub-ident-fn-2.stderr6
-rw-r--r--tests/ui/pub/pub-ident-fn-or-struct.stderr9
-rw-r--r--tests/ui/pub/pub-ident-fn-with-lifetime-2.rs2
-rw-r--r--tests/ui/pub/pub-ident-fn-with-lifetime-2.stderr8
-rw-r--r--tests/ui/pub/pub-ident-fn-with-lifetime.rs2
-rw-r--r--tests/ui/pub/pub-ident-fn-with-lifetime.stderr8
-rw-r--r--tests/ui/pub/pub-ident-fn.rs2
-rw-r--r--tests/ui/pub/pub-ident-fn.stderr8
-rw-r--r--tests/ui/pub/pub-ident-struct-2.stderr6
-rw-r--r--tests/ui/pub/pub-ident-struct-3.stderr6
-rw-r--r--tests/ui/pub/pub-ident-struct-4.stderr6
-rw-r--r--tests/ui/pub/pub-ident-struct-with-lifetime.rs2
-rw-r--r--tests/ui/pub/pub-ident-struct-with-lifetime.stderr11
-rw-r--r--tests/ui/pub/pub-ident-struct.fixed6
-rw-r--r--tests/ui/pub/pub-ident-struct.rs4
-rw-r--r--tests/ui/pub/pub-ident-struct.stderr11
-rw-r--r--tests/ui/pub/pub-ident-with-lifetime-incomplete.rs2
-rw-r--r--tests/ui/pub/pub-ident-with-lifetime-incomplete.stderr6
18 files changed, 46 insertions, 59 deletions
diff --git a/tests/ui/pub/pub-ident-fn-2.stderr b/tests/ui/pub/pub-ident-fn-2.stderr
index e724278b233..80f4b14da89 100644
--- a/tests/ui/pub/pub-ident-fn-2.stderr
+++ b/tests/ui/pub/pub-ident-fn-2.stderr
@@ -1,10 +1,10 @@
 error: missing `fn` for function definition
-  --> $DIR/pub-ident-fn-2.rs:3:4
+  --> $DIR/pub-ident-fn-2.rs:3:1
    |
 LL | pub foo(_s: usize) { bar() }
-   |    ^
+   | ^^^^^^^
    |
-help: add `fn` here to parse `foo` as a public function
+help: add `fn` here to parse `foo` as a function
    |
 LL | pub fn foo(_s: usize) { bar() }
    |     ++
diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr
index a8fa4bd3bd3..ceadc510c63 100644
--- a/tests/ui/pub/pub-ident-fn-or-struct.stderr
+++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr
@@ -1,8 +1,13 @@
 error: missing `fn` or `struct` for function or struct definition
-  --> $DIR/pub-ident-fn-or-struct.rs:1:4
+  --> $DIR/pub-ident-fn-or-struct.rs:1:1
    |
 LL | pub S (foo) bar
-   | ---^- help: if you meant to call a macro, try: `S!`
+   | ^^^^^
+   |
+help: if you meant to call a macro, try
+   |
+LL | pub S! (foo) bar
+   |     ~~
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/pub/pub-ident-fn-with-lifetime-2.rs b/tests/ui/pub/pub-ident-fn-with-lifetime-2.rs
index 1ee8c84f13b..3fb93cb669b 100644
--- a/tests/ui/pub/pub-ident-fn-with-lifetime-2.rs
+++ b/tests/ui/pub/pub-ident-fn-with-lifetime-2.rs
@@ -1,4 +1,4 @@
-pub   bar<'a>(&self, _s: &'a usize) -> bool { true }
+pub bar<'a>(&self, _s: &'a usize) -> bool { true }
 //~^ ERROR missing `fn` for method definition
 
 fn main() {
diff --git a/tests/ui/pub/pub-ident-fn-with-lifetime-2.stderr b/tests/ui/pub/pub-ident-fn-with-lifetime-2.stderr
index b0d5ce9de5c..e6523ca58ab 100644
--- a/tests/ui/pub/pub-ident-fn-with-lifetime-2.stderr
+++ b/tests/ui/pub/pub-ident-fn-with-lifetime-2.stderr
@@ -1,10 +1,10 @@
 error: missing `fn` for method definition
-  --> $DIR/pub-ident-fn-with-lifetime-2.rs:1:4
+  --> $DIR/pub-ident-fn-with-lifetime-2.rs:1:1
    |
-LL | pub   bar<'a>(&self, _s: &'a usize) -> bool { true }
-   |    ^^^
+LL | pub bar<'a>(&self, _s: &'a usize) -> bool { true }
+   | ^^^^^^^
    |
-help: add `fn` here to parse `bar` as a public method
+help: add `fn` here to parse `bar` as a method
    |
 LL | pub fn bar<'a>(&self, _s: &'a usize) -> bool { true }
    |     ++
diff --git a/tests/ui/pub/pub-ident-fn-with-lifetime.rs b/tests/ui/pub/pub-ident-fn-with-lifetime.rs
index 8cdc152f163..0fd25ca0b1c 100644
--- a/tests/ui/pub/pub-ident-fn-with-lifetime.rs
+++ b/tests/ui/pub/pub-ident-fn-with-lifetime.rs
@@ -1,6 +1,6 @@
 //@ run-rustfix
 
-pub   foo<'a>(_s: &'a usize) -> bool { true }
+pub foo<'a>(_s: &'a usize) -> bool { true }
 //~^ ERROR missing `fn` for function definition
 
 fn main() {
diff --git a/tests/ui/pub/pub-ident-fn-with-lifetime.stderr b/tests/ui/pub/pub-ident-fn-with-lifetime.stderr
index 63fcf6bf5d5..52c6206a75f 100644
--- a/tests/ui/pub/pub-ident-fn-with-lifetime.stderr
+++ b/tests/ui/pub/pub-ident-fn-with-lifetime.stderr
@@ -1,10 +1,10 @@
 error: missing `fn` for function definition
-  --> $DIR/pub-ident-fn-with-lifetime.rs:3:4
+  --> $DIR/pub-ident-fn-with-lifetime.rs:3:1
    |
-LL | pub   foo<'a>(_s: &'a usize) -> bool { true }
-   |    ^^^
+LL | pub foo<'a>(_s: &'a usize) -> bool { true }
+   | ^^^^^^^
    |
-help: add `fn` here to parse `foo` as a public function
+help: add `fn` here to parse `foo` as a function
    |
 LL | pub fn foo<'a>(_s: &'a usize) -> bool { true }
    |     ++
diff --git a/tests/ui/pub/pub-ident-fn.rs b/tests/ui/pub/pub-ident-fn.rs
index 899ea82ccb7..1032f3375ea 100644
--- a/tests/ui/pub/pub-ident-fn.rs
+++ b/tests/ui/pub/pub-ident-fn.rs
@@ -1,6 +1,6 @@
 //@ run-rustfix
 
-pub   foo(_s: usize) -> bool { true }
+pub foo(_s: usize) -> bool { true }
 //~^ ERROR missing `fn` for function definition
 
 fn main() {
diff --git a/tests/ui/pub/pub-ident-fn.stderr b/tests/ui/pub/pub-ident-fn.stderr
index 06dac616443..54360061fef 100644
--- a/tests/ui/pub/pub-ident-fn.stderr
+++ b/tests/ui/pub/pub-ident-fn.stderr
@@ -1,10 +1,10 @@
 error: missing `fn` for function definition
-  --> $DIR/pub-ident-fn.rs:3:4
+  --> $DIR/pub-ident-fn.rs:3:1
    |
-LL | pub   foo(_s: usize) -> bool { true }
-   |    ^^^
+LL | pub foo(_s: usize) -> bool { true }
+   | ^^^^^^^
    |
-help: add `fn` here to parse `foo` as a public function
+help: add `fn` here to parse `foo` as a function
    |
 LL | pub fn foo(_s: usize) -> bool { true }
    |     ++
diff --git a/tests/ui/pub/pub-ident-struct-2.stderr b/tests/ui/pub/pub-ident-struct-2.stderr
index 5e0f328d986..ef2ff1d2f0e 100644
--- a/tests/ui/pub/pub-ident-struct-2.stderr
+++ b/tests/ui/pub/pub-ident-struct-2.stderr
@@ -1,10 +1,10 @@
 error: missing `struct` for struct definition
-  --> $DIR/pub-ident-struct-2.rs:4:8
+  --> $DIR/pub-ident-struct-2.rs:4:5
    |
 LL |     pub bar();
-   |        ^
+   |     ^^^^^^^
    |
-help: add `struct` here to parse `bar` as a public struct
+help: add `struct` here to parse `bar` as a struct
    |
 LL |     pub struct bar();
    |         ++++++
diff --git a/tests/ui/pub/pub-ident-struct-3.stderr b/tests/ui/pub/pub-ident-struct-3.stderr
index d08e5120570..0a23ad51211 100644
--- a/tests/ui/pub/pub-ident-struct-3.stderr
+++ b/tests/ui/pub/pub-ident-struct-3.stderr
@@ -1,10 +1,10 @@
 error: missing `struct` for struct definition
-  --> $DIR/pub-ident-struct-3.rs:1:4
+  --> $DIR/pub-ident-struct-3.rs:1:1
    |
 LL | pub S();
-   |    ^
+   | ^^^^^
    |
-help: add `struct` here to parse `S` as a public struct
+help: add `struct` here to parse `S` as a struct
    |
 LL | pub struct S();
    |     ++++++
diff --git a/tests/ui/pub/pub-ident-struct-4.stderr b/tests/ui/pub/pub-ident-struct-4.stderr
index ec136783211..d3072464e05 100644
--- a/tests/ui/pub/pub-ident-struct-4.stderr
+++ b/tests/ui/pub/pub-ident-struct-4.stderr
@@ -1,10 +1,10 @@
 error: missing `struct` for struct definition
-  --> $DIR/pub-ident-struct-4.rs:4:4
+  --> $DIR/pub-ident-struct-4.rs:4:1
    |
 LL | pub T(String);
-   |    ^
+   | ^^^^^
    |
-help: add `struct` here to parse `T` as a public struct
+help: add `struct` here to parse `T` as a struct
    |
 LL | pub struct T(String);
    |     ++++++
diff --git a/tests/ui/pub/pub-ident-struct-with-lifetime.rs b/tests/ui/pub/pub-ident-struct-with-lifetime.rs
index 2feb0266070..baa5dc8cfb9 100644
--- a/tests/ui/pub/pub-ident-struct-with-lifetime.rs
+++ b/tests/ui/pub/pub-ident-struct-with-lifetime.rs
@@ -1,4 +1,4 @@
 pub S<'a> {
-//~^ ERROR missing `struct` for struct definition
+//~^ ERROR missing `enum` or `struct` for enum or struct definition
 }
 fn main() {}
diff --git a/tests/ui/pub/pub-ident-struct-with-lifetime.stderr b/tests/ui/pub/pub-ident-struct-with-lifetime.stderr
index 0e08a5ff449..1367c941f80 100644
--- a/tests/ui/pub/pub-ident-struct-with-lifetime.stderr
+++ b/tests/ui/pub/pub-ident-struct-with-lifetime.stderr
@@ -1,13 +1,8 @@
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-struct-with-lifetime.rs:1:4
+error: missing `enum` or `struct` for enum or struct definition
+  --> $DIR/pub-ident-struct-with-lifetime.rs:1:1
    |
 LL | pub S<'a> {
-   |    ^
-   |
-help: add `struct` here to parse `S` as a public struct
-   |
-LL | pub struct S<'a> {
-   |     ++++++
+   | ^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/pub/pub-ident-struct.fixed b/tests/ui/pub/pub-ident-struct.fixed
deleted file mode 100644
index 3f0610cd765..00000000000
--- a/tests/ui/pub/pub-ident-struct.fixed
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ run-rustfix
-
-pub struct S {
-//~^ ERROR missing `struct` for struct definition
-}
-fn main() {}
diff --git a/tests/ui/pub/pub-ident-struct.rs b/tests/ui/pub/pub-ident-struct.rs
index 6d06c406f6c..f9f31a9ed2b 100644
--- a/tests/ui/pub/pub-ident-struct.rs
+++ b/tests/ui/pub/pub-ident-struct.rs
@@ -1,6 +1,4 @@
-//@ run-rustfix
-
 pub S {
-//~^ ERROR missing `struct` for struct definition
+//~^ ERROR missing `enum` or `struct` for enum or struct definition
 }
 fn main() {}
diff --git a/tests/ui/pub/pub-ident-struct.stderr b/tests/ui/pub/pub-ident-struct.stderr
index 2d5d61d9381..6d85305ceaf 100644
--- a/tests/ui/pub/pub-ident-struct.stderr
+++ b/tests/ui/pub/pub-ident-struct.stderr
@@ -1,13 +1,8 @@
-error: missing `struct` for struct definition
-  --> $DIR/pub-ident-struct.rs:3:4
+error: missing `enum` or `struct` for enum or struct definition
+  --> $DIR/pub-ident-struct.rs:1:1
    |
 LL | pub S {
-   |    ^
-   |
-help: add `struct` here to parse `S` as a public struct
-   |
-LL | pub struct S {
-   |     ++++++
+   | ^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/pub/pub-ident-with-lifetime-incomplete.rs b/tests/ui/pub/pub-ident-with-lifetime-incomplete.rs
index c86a9f2fdd6..dec1a502646 100644
--- a/tests/ui/pub/pub-ident-with-lifetime-incomplete.rs
+++ b/tests/ui/pub/pub-ident-with-lifetime-incomplete.rs
@@ -1,5 +1,5 @@
 fn main() {
 }
 
-pub   foo<'a>
+pub foo<'a>
 //~^ ERROR missing `fn` or `struct` for function or struct definition
diff --git a/tests/ui/pub/pub-ident-with-lifetime-incomplete.stderr b/tests/ui/pub/pub-ident-with-lifetime-incomplete.stderr
index 750e2d17e0a..67b6b9c7ba8 100644
--- a/tests/ui/pub/pub-ident-with-lifetime-incomplete.stderr
+++ b/tests/ui/pub/pub-ident-with-lifetime-incomplete.stderr
@@ -1,8 +1,8 @@
 error: missing `fn` or `struct` for function or struct definition
-  --> $DIR/pub-ident-with-lifetime-incomplete.rs:4:4
+  --> $DIR/pub-ident-with-lifetime-incomplete.rs:4:1
    |
-LL | pub   foo<'a>
-   |    ^^^
+LL | pub foo<'a>
+   | ^^^^^^^
 
 error: aborting due to 1 previous error