about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2021-04-08 18:35:04 -0700
committerEsteban Küber <esteban@kuber.com.ar>2021-04-08 19:14:39 -0700
commit8e8159681f216e74c4e45aaa6440da0ecad8b5c3 (patch)
tree99d9683ec15fedc3dd5dab662c382f59d86e0c57
parent010c2368fa33ef08df3080228498db8d2ba5a93b (diff)
Add unclosed brace in use tree test
-rw-r--r--src/test/ui/parser/use-unclosed-brace.rs26
-rw-r--r--src/test/ui/parser/use-unclosed-brace.stderr139
2 files changed, 165 insertions, 0 deletions
diff --git a/src/test/ui/parser/use-unclosed-brace.rs b/src/test/ui/parser/use-unclosed-brace.rs
new file mode 100644
index 00000000000..c2e60dd3e7f
--- /dev/null
+++ b/src/test/ui/parser/use-unclosed-brace.rs
@@ -0,0 +1,26 @@
+use foo::{bar, baz;
+//~^ ERROR expected one of `,`, `::`, `as`, or `}`, found `;`
+
+use std::fmt::Display;
+//~^ ERROR expected identifier, found keyword `use`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `std`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `;`
+
+mod bar { }
+//~^ ERROR expected identifier, found keyword `mod`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `bar`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `{`
+
+mod baz { }
+//~^ ERROR expected identifier, found keyword `mod`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `{`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `baz`
+//~| ERROR expected one of `,` or `}`, found keyword `mod`
+
+fn main() {}
+//~^ ERROR expected identifier, found keyword `fn`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `(`
+//~| ERROR expected one of `,` or `}`, found keyword `fn`
+//~| ERROR expected one of `,`, `::`, `as`, or `}`, found `main`
+
+//~ ERROR this file contains an unclosed delimiter
\ No newline at end of file
diff --git a/src/test/ui/parser/use-unclosed-brace.stderr b/src/test/ui/parser/use-unclosed-brace.stderr
new file mode 100644
index 00000000000..4e443f0704f
--- /dev/null
+++ b/src/test/ui/parser/use-unclosed-brace.stderr
@@ -0,0 +1,139 @@
+error: this file contains an unclosed delimiter
+  --> $DIR/use-unclosed-brace.rs:26:51
+   |
+LL | use foo::{bar, baz;
+   |          - unclosed delimiter
+...
+LL |
+   |                                                   ^
+
+error: expected identifier, found keyword `use`
+  --> $DIR/use-unclosed-brace.rs:4:1
+   |
+LL | use std::fmt::Display;
+   | ^^^ expected identifier, found keyword
+
+error: expected one of `,`, `::`, `as`, or `}`, found `;`
+  --> $DIR/use-unclosed-brace.rs:1:19
+   |
+LL | use foo::{bar, baz;
+   |          -        ^ expected one of `,`, `::`, `as`, or `}`
+   |          |
+   |          unclosed delimiter
+   |
+help: `}` may belong here
+   |
+LL | use foo::{bar, baz};
+   |                   ^
+help: missing `,`
+   |
+LL | use foo::{bar, baz,;
+   |                   ^
+
+error: expected one of `,`, `::`, `as`, or `}`, found `std`
+  --> $DIR/use-unclosed-brace.rs:4:5
+   |
+LL | use std::fmt::Display;
+   |    -^^^ expected one of `,`, `::`, `as`, or `}`
+   |    |
+   |    help: missing `,`
+
+error: expected identifier, found keyword `mod`
+  --> $DIR/use-unclosed-brace.rs:9:1
+   |
+LL | mod bar { }
+   | ^^^ expected identifier, found keyword
+
+error: expected one of `,`, `::`, `as`, or `}`, found `;`
+  --> $DIR/use-unclosed-brace.rs:4:22
+   |
+LL | use std::fmt::Display;
+   |                      ^
+   |                      |
+   |                      expected one of `,`, `::`, `as`, or `}`
+   |                      help: missing `,`
+
+error: expected one of `,`, `::`, `as`, or `}`, found `bar`
+  --> $DIR/use-unclosed-brace.rs:9:5
+   |
+LL | mod bar { }
+   |    -^^^ expected one of `,`, `::`, `as`, or `}`
+   |    |
+   |    help: missing `,`
+
+error: expected one of `,`, `::`, `as`, or `}`, found `{`
+  --> $DIR/use-unclosed-brace.rs:9:9
+   |
+LL | mod bar { }
+   |        -^ expected one of `,`, `::`, `as`, or `}`
+   |        |
+   |        help: missing `,`
+
+error: expected identifier, found keyword `mod`
+  --> $DIR/use-unclosed-brace.rs:14:1
+   |
+LL | mod baz { }
+   | ^^^ expected identifier, found keyword
+
+error: expected one of `,` or `}`, found keyword `mod`
+  --> $DIR/use-unclosed-brace.rs:14:1
+   |
+LL | mod bar { }
+   |            -
+   |            |
+   |            expected one of `,` or `}`
+   |            help: missing `,`
+...
+LL | mod baz { }
+   | ^^^ unexpected token
+
+error: expected one of `,`, `::`, `as`, or `}`, found `baz`
+  --> $DIR/use-unclosed-brace.rs:14:5
+   |
+LL | mod baz { }
+   |    -^^^ expected one of `,`, `::`, `as`, or `}`
+   |    |
+   |    help: missing `,`
+
+error: expected one of `,`, `::`, `as`, or `}`, found `{`
+  --> $DIR/use-unclosed-brace.rs:14:9
+   |
+LL | mod baz { }
+   |        -^ expected one of `,`, `::`, `as`, or `}`
+   |        |
+   |        help: missing `,`
+
+error: expected identifier, found keyword `fn`
+  --> $DIR/use-unclosed-brace.rs:20:1
+   |
+LL | fn main() {}
+   | ^^ expected identifier, found keyword
+
+error: expected one of `,` or `}`, found keyword `fn`
+  --> $DIR/use-unclosed-brace.rs:20:1
+   |
+LL | mod baz { }
+   |            -
+   |            |
+   |            expected one of `,` or `}`
+   |            help: missing `,`
+...
+LL | fn main() {}
+   | ^^ unexpected token
+
+error: expected one of `,`, `::`, `as`, or `}`, found `main`
+  --> $DIR/use-unclosed-brace.rs:20:4
+   |
+LL | fn main() {}
+   |   -^^^^ expected one of `,`, `::`, `as`, or `}`
+   |   |
+   |   help: missing `,`
+
+error: expected one of `,`, `::`, `as`, or `}`, found `(`
+  --> $DIR/use-unclosed-brace.rs:20:8
+   |
+LL | fn main() {}
+   |        ^ expected one of `,`, `::`, `as`, or `}`
+
+error: aborting due to 16 previous errors
+