summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/mismatched-braces
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/parser/mismatched-braces')
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs13
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr34
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs13
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr17
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs12
-rw-r--r--src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr27
6 files changed, 116 insertions, 0 deletions
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
new file mode 100644
index 000000000..8f46970b1
--- /dev/null
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
@@ -0,0 +1,13 @@
+fn main() {}
+
+impl T for () { //~ ERROR cannot find trait `T` in this scope
+
+fn foo(&self) {}
+
+trait T { //~ ERROR trait is not supported in `trait`s or `impl`s
+ fn foo(&self);
+}
+
+pub(crate) struct Bar<T>(); //~ ERROR struct is not supported in `trait`s or `impl`s
+
+//~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
new file mode 100644
index 000000000..cc7cc0c55
--- /dev/null
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
@@ -0,0 +1,34 @@
+error: this file contains an unclosed delimiter
+ --> $DIR/missing-close-brace-in-impl-trait.rs:13:52
+ |
+LL | impl T for () {
+ | - unclosed delimiter
+...
+LL |
+ | ^
+
+error: trait is not supported in `trait`s or `impl`s
+ --> $DIR/missing-close-brace-in-impl-trait.rs:7:1
+ |
+LL | trait T {
+ | ^^^^^^^
+ |
+ = help: consider moving the trait out to a nearby module scope
+
+error: struct is not supported in `trait`s or `impl`s
+ --> $DIR/missing-close-brace-in-impl-trait.rs:11:1
+ |
+LL | pub(crate) struct Bar<T>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider moving the struct out to a nearby module scope
+
+error[E0405]: cannot find trait `T` in this scope
+ --> $DIR/missing-close-brace-in-impl-trait.rs:3:6
+ |
+LL | impl T for () {
+ | ^ not found in this scope
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0405`.
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs
new file mode 100644
index 000000000..090a17b41
--- /dev/null
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs
@@ -0,0 +1,13 @@
+pub(crate) struct Bar<T> {
+ foo: T,
+
+trait T { //~ ERROR expected identifier, found keyword `trait`
+ fn foo(&self);
+}
+
+
+impl T for Bar<usize> {
+fn foo(&self) {}
+}
+
+fn main() {} //~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr
new file mode 100644
index 000000000..a47d5506e
--- /dev/null
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr
@@ -0,0 +1,17 @@
+error: this file contains an unclosed delimiter
+ --> $DIR/missing-close-brace-in-struct.rs:13:65
+ |
+LL | pub(crate) struct Bar<T> {
+ | - unclosed delimiter
+...
+LL | fn main() {}
+ | ^
+
+error: expected identifier, found keyword `trait`
+ --> $DIR/missing-close-brace-in-struct.rs:4:1
+ |
+LL | trait T {
+ | ^^^^^ expected identifier, found keyword
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
new file mode 100644
index 000000000..b6932deb5
--- /dev/null
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
@@ -0,0 +1,12 @@
+trait T {
+ fn foo(&self);
+
+pub(crate) struct Bar<T>();
+//~^ ERROR struct is not supported in `trait`s or `impl`s
+
+impl T for Bar<usize> {
+//~^ ERROR implementation is not supported in `trait`s or `impl`s
+fn foo(&self) {}
+}
+
+fn main() {} //~ ERROR this file contains an unclosed delimiter
diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
new file mode 100644
index 000000000..7c6254356
--- /dev/null
+++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
@@ -0,0 +1,27 @@
+error: this file contains an unclosed delimiter
+ --> $DIR/missing-close-brace-in-trait.rs:12:65
+ |
+LL | trait T {
+ | - unclosed delimiter
+...
+LL | fn main() {}
+ | ^
+
+error: struct is not supported in `trait`s or `impl`s
+ --> $DIR/missing-close-brace-in-trait.rs:4:1
+ |
+LL | pub(crate) struct Bar<T>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider moving the struct out to a nearby module scope
+
+error: implementation is not supported in `trait`s or `impl`s
+ --> $DIR/missing-close-brace-in-trait.rs:7:1
+ |
+LL | impl T for Bar<usize> {
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider moving the implementation out to a nearby module scope
+
+error: aborting due to 3 previous errors
+