about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/parser/issue-87694-duplicated-pub.rs5
-rw-r--r--src/test/ui/parser/issue-87694-duplicated-pub.stderr17
-rw-r--r--src/test/ui/parser/issue-87694-misplaced-pub.rs5
-rw-r--r--src/test/ui/parser/issue-87694-misplaced-pub.stderr10
4 files changed, 37 insertions, 0 deletions
diff --git a/src/test/ui/parser/issue-87694-duplicated-pub.rs b/src/test/ui/parser/issue-87694-duplicated-pub.rs
new file mode 100644
index 00000000000..cf6e463d41d
--- /dev/null
+++ b/src/test/ui/parser/issue-87694-duplicated-pub.rs
@@ -0,0 +1,5 @@
+pub const pub fn test() {}
+//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+//~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe`
+//~| HELP there is already a visibility, remove this one
+//~| NOTE explicit visibility first seen here
diff --git a/src/test/ui/parser/issue-87694-duplicated-pub.stderr b/src/test/ui/parser/issue-87694-duplicated-pub.stderr
new file mode 100644
index 00000000000..9d62c3feb55
--- /dev/null
+++ b/src/test/ui/parser/issue-87694-duplicated-pub.stderr
@@ -0,0 +1,17 @@
+error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+  --> $DIR/issue-87694-duplicated-pub.rs:1:11
+   |
+LL | pub const pub fn test() {}
+   |           ^^^
+   |           |
+   |           expected one of `async`, `extern`, `fn`, or `unsafe`
+   |           help: there is already a visibility, remove this one
+   |
+note: explicit visibility first seen here
+  --> $DIR/issue-87694-duplicated-pub.rs:1:1
+   |
+LL | pub const pub fn test() {}
+   | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issue-87694-misplaced-pub.rs b/src/test/ui/parser/issue-87694-misplaced-pub.rs
new file mode 100644
index 00000000000..3f824617cad
--- /dev/null
+++ b/src/test/ui/parser/issue-87694-misplaced-pub.rs
@@ -0,0 +1,5 @@
+const pub fn test() {}
+//~^ ERROR expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+//~| NOTE expected one of `async`, `extern`, `fn`, or `unsafe`
+//~| HELP visibility `pub` must come before `const`
+//~| SUGGESTION pub const
diff --git a/src/test/ui/parser/issue-87694-misplaced-pub.stderr b/src/test/ui/parser/issue-87694-misplaced-pub.stderr
new file mode 100644
index 00000000000..ac588ad5a77
--- /dev/null
+++ b/src/test/ui/parser/issue-87694-misplaced-pub.stderr
@@ -0,0 +1,10 @@
+error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub`
+  --> $DIR/issue-87694-misplaced-pub.rs:1:7
+   |
+LL | const pub fn test() {}
+   | ----- ^^^ expected one of `async`, `extern`, `fn`, or `unsafe`
+   | |
+   | help: visibility `pub` must come before `const`: `pub const`
+
+error: aborting due to previous error
+