about summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-10-20 23:53:16 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-10-21 14:06:28 +0300
commit51f3b6241df34249c7a8100a5dde75e6ab95533d (patch)
tree289cac0e7ae6e9fbaaf6fe6f086f4a4feea6fa03 /src/test/ui/parser
parent52ede63263babc3479357308c12245524df75b18 (diff)
downloadrust-51f3b6241df34249c7a8100a5dde75e6ab95533d.tar.gz
rust-51f3b6241df34249c7a8100a5dde75e6ab95533d.zip
Move more parsing tests to ui/parser
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/bounds-obj-parens.rs16
-rw-r--r--src/test/ui/parser/bounds-obj-parens.stderr8
-rw-r--r--src/test/ui/parser/impl-parsing.rs21
-rw-r--r--src/test/ui/parser/impl-parsing.stderr32
-rw-r--r--src/test/ui/parser/issue-10636-1.rs20
-rw-r--r--src/test/ui/parser/issue-10636-1.stderr11
-rw-r--r--src/test/ui/parser/issue-10636-2.rs21
-rw-r--r--src/test/ui/parser/issue-10636-2.stderr25
-rw-r--r--src/test/ui/parser/issue-15980.rs29
-rw-r--r--src/test/ui/parser/issue-15980.stderr27
-rw-r--r--src/test/ui/parser/issue-2354.rs26
-rw-r--r--src/test/ui/parser/issue-2354.stderr16
-rw-r--r--src/test/ui/parser/issue-41155.rs15
-rw-r--r--src/test/ui/parser/issue-41155.stderr17
-rw-r--r--src/test/ui/parser/macro-incomplete-parse.rs39
-rw-r--r--src/test/ui/parser/macro-incomplete-parse.stderr35
-rw-r--r--src/test/ui/parser/match-refactor-to-expr.rs22
-rw-r--r--src/test/ui/parser/match-refactor-to-expr.stderr13
-rw-r--r--src/test/ui/parser/raw/raw-literal-keywords.rs23
-rw-r--r--src/test/ui/parser/raw/raw-literal-keywords.stderr20
-rw-r--r--src/test/ui/parser/raw/raw-literal-self.rs15
-rw-r--r--src/test/ui/parser/raw/raw-literal-self.stderr8
-rw-r--r--src/test/ui/parser/raw/raw-literal-underscore.rs15
-rw-r--r--src/test/ui/parser/raw/raw-literal-underscore.stderr8
-rw-r--r--src/test/ui/parser/raw/raw_string.rs14
-rw-r--r--src/test/ui/parser/raw/raw_string.stderr10
-rw-r--r--src/test/ui/parser/trailing-plus-in-bounds.rs20
-rw-r--r--src/test/ui/parser/trailing-plus-in-bounds.stderr8
28 files changed, 534 insertions, 0 deletions
diff --git a/src/test/ui/parser/bounds-obj-parens.rs b/src/test/ui/parser/bounds-obj-parens.rs
new file mode 100644
index 00000000000..9617df8fa21
--- /dev/null
+++ b/src/test/ui/parser/bounds-obj-parens.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// compile-flags: -Z parse-only
+
+type A = Box<(Fn(D::Error) -> E) + 'static + Send + Sync>; // OK (but see #39318)
+
+FAIL
+//~^ ERROR
diff --git a/src/test/ui/parser/bounds-obj-parens.stderr b/src/test/ui/parser/bounds-obj-parens.stderr
new file mode 100644
index 00000000000..67dcbc45419
--- /dev/null
+++ b/src/test/ui/parser/bounds-obj-parens.stderr
@@ -0,0 +1,8 @@
+error: expected one of `!` or `::`, found `<eof>`
+  --> $DIR/bounds-obj-parens.rs:15:1
+   |
+LL | FAIL
+   | ^^^^ expected one of `!` or `::` here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/impl-parsing.rs b/src/test/ui/parser/impl-parsing.rs
new file mode 100644
index 00000000000..064e3c3ac48
--- /dev/null
+++ b/src/test/ui/parser/impl-parsing.rs
@@ -0,0 +1,21 @@
+// 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.
+
+// compile-flags: -Z parse-only -Z continue-parse-after-error
+
+impl ! {} // OK
+impl ! where u8: Copy {} // OK
+
+impl Trait Type {} //~ ERROR missing `for` in a trait impl
+impl Trait .. {} //~ ERROR missing `for` in a trait impl
+impl ?Sized for Type {} //~ ERROR expected a trait, found type
+impl ?Sized for .. {} //~ ERROR expected a trait, found type
+
+default unsafe FAIL //~ ERROR expected `impl`, found `FAIL`
diff --git a/src/test/ui/parser/impl-parsing.stderr b/src/test/ui/parser/impl-parsing.stderr
new file mode 100644
index 00000000000..3cfcf7b7683
--- /dev/null
+++ b/src/test/ui/parser/impl-parsing.stderr
@@ -0,0 +1,32 @@
+error: missing `for` in a trait impl
+  --> $DIR/impl-parsing.rs:16:11
+   |
+LL | impl Trait Type {} //~ ERROR missing `for` in a trait impl
+   |           ^
+
+error: missing `for` in a trait impl
+  --> $DIR/impl-parsing.rs:17:11
+   |
+LL | impl Trait .. {} //~ ERROR missing `for` in a trait impl
+   |           ^
+
+error: expected a trait, found type
+  --> $DIR/impl-parsing.rs:18:6
+   |
+LL | impl ?Sized for Type {} //~ ERROR expected a trait, found type
+   |      ^^^^^^
+
+error: expected a trait, found type
+  --> $DIR/impl-parsing.rs:19:6
+   |
+LL | impl ?Sized for .. {} //~ ERROR expected a trait, found type
+   |      ^^^^^^
+
+error: expected `impl`, found `FAIL`
+  --> $DIR/impl-parsing.rs:21:16
+   |
+LL | default unsafe FAIL //~ ERROR expected `impl`, found `FAIL`
+   |                ^^^^ expected `impl` here
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/ui/parser/issue-10636-1.rs b/src/test/ui/parser/issue-10636-1.rs
new file mode 100644
index 00000000000..375b951ee15
--- /dev/null
+++ b/src/test/ui/parser/issue-10636-1.rs
@@ -0,0 +1,20 @@
+// Copyright 2013 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.
+
+// compile-flags: -Z parse-only
+
+struct Obj {
+    //~^ NOTE: un-closed delimiter
+    member: usize
+)
+//~^ ERROR incorrect close delimiter
+//~| NOTE incorrect close delimiter
+
+fn main() {}
diff --git a/src/test/ui/parser/issue-10636-1.stderr b/src/test/ui/parser/issue-10636-1.stderr
new file mode 100644
index 00000000000..49b6d08aff5
--- /dev/null
+++ b/src/test/ui/parser/issue-10636-1.stderr
@@ -0,0 +1,11 @@
+error: incorrect close delimiter: `)`
+  --> $DIR/issue-10636-1.rs:16:1
+   |
+LL | struct Obj {
+   |            - un-closed delimiter
+...
+LL | )
+   | ^ incorrect close delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issue-10636-2.rs b/src/test/ui/parser/issue-10636-2.rs
new file mode 100644
index 00000000000..71180375440
--- /dev/null
+++ b/src/test/ui/parser/issue-10636-2.rs
@@ -0,0 +1,21 @@
+// Copyright 2013-2016 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.
+
+// FIXME(31528) we emit a bunch of silly errors here due to continuing past the
+// first one. This would be easy-ish to address by better recovery in tokenisation.
+
+pub fn trace_option(option: Option<isize>) {
+    option.map(|some| 42;
+                          //~^ ERROR: expected one of
+
+} //~ ERROR: incorrect close delimiter
+//~^ ERROR: expected expression, found `)`
+
+fn main() {}
diff --git a/src/test/ui/parser/issue-10636-2.stderr b/src/test/ui/parser/issue-10636-2.stderr
new file mode 100644
index 00000000000..9800b0c5e3f
--- /dev/null
+++ b/src/test/ui/parser/issue-10636-2.stderr
@@ -0,0 +1,25 @@
+error: incorrect close delimiter: `}`
+  --> $DIR/issue-10636-2.rs:18:1
+   |
+LL | pub fn trace_option(option: Option<isize>) {
+   |                                            - close delimiter possibly meant for this
+LL |     option.map(|some| 42;
+   |               - un-closed delimiter
+...
+LL | } //~ ERROR: incorrect close delimiter
+   | ^ incorrect close delimiter
+
+error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
+  --> $DIR/issue-10636-2.rs:15:25
+   |
+LL |     option.map(|some| 42;
+   |                         ^ expected one of `)`, `,`, `.`, `?`, or an operator here
+
+error: expected expression, found `)`
+  --> $DIR/issue-10636-2.rs:18:1
+   |
+LL | } //~ ERROR: incorrect close delimiter
+   | ^ expected expression
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/issue-15980.rs b/src/test/ui/parser/issue-15980.rs
new file mode 100644
index 00000000000..e1b134c8203
--- /dev/null
+++ b/src/test/ui/parser/issue-15980.rs
@@ -0,0 +1,29 @@
+// Copyright 2018 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.
+
+use std::io;
+
+fn main(){
+    let x: io::IoResult<()> = Ok(());
+    //~^ ERROR cannot find type `IoResult` in module `io`
+    //~| NOTE did you mean `Result`?
+    match x {
+        Err(ref e) if e.kind == io::EndOfFile {
+            //~^ NOTE while parsing this struct
+            return
+            //~^ ERROR expected identifier, found keyword `return`
+            //~| NOTE expected identifier, found keyword
+        }
+        //~^ NOTE expected one of `.`, `=>`, `?`, or an operator here
+        _ => {}
+        //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found `_`
+        //~| NOTE unexpected token
+    }
+}
diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr
new file mode 100644
index 00000000000..d52368bf96a
--- /dev/null
+++ b/src/test/ui/parser/issue-15980.stderr
@@ -0,0 +1,27 @@
+error: expected identifier, found keyword `return`
+  --> $DIR/issue-15980.rs:20:13
+   |
+LL |         Err(ref e) if e.kind == io::EndOfFile {
+   |                                 ------------- while parsing this struct
+LL |             //~^ NOTE while parsing this struct
+LL |             return
+   |             ^^^^^^ expected identifier, found keyword
+
+error: expected one of `.`, `=>`, `?`, or an operator, found `_`
+  --> $DIR/issue-15980.rs:25:9
+   |
+LL |         }
+   |          - expected one of `.`, `=>`, `?`, or an operator here
+LL |         //~^ NOTE expected one of `.`, `=>`, `?`, or an operator here
+LL |         _ => {}
+   |         ^ unexpected token
+
+error[E0412]: cannot find type `IoResult` in module `io`
+  --> $DIR/issue-15980.rs:14:16
+   |
+LL |     let x: io::IoResult<()> = Ok(());
+   |                ^^^^^^^^ did you mean `Result`?
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/parser/issue-2354.rs b/src/test/ui/parser/issue-2354.rs
new file mode 100644
index 00000000000..35fddcb0de4
--- /dev/null
+++ b/src/test/ui/parser/issue-2354.rs
@@ -0,0 +1,26 @@
+// Copyright 2012 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.
+
+// compile-flags: -Z parse-only
+
+fn foo() { //~ NOTE un-closed delimiter
+  match Some(x) {
+  //~^ NOTE this delimiter might not be properly closed...
+      Some(y) => { panic!(); }
+      None => { panic!(); }
+}
+//~^ NOTE ...as it matches this but it has different indentation
+
+fn bar() {
+    let mut i = 0;
+    while (i < 1000) {}
+}
+
+fn main() {} //~ ERROR this file contains an un-closed delimiter
diff --git a/src/test/ui/parser/issue-2354.stderr b/src/test/ui/parser/issue-2354.stderr
new file mode 100644
index 00000000000..9cf569b685b
--- /dev/null
+++ b/src/test/ui/parser/issue-2354.stderr
@@ -0,0 +1,16 @@
+error: this file contains an un-closed delimiter
+  --> $DIR/issue-2354.rs:26:66
+   |
+LL | fn foo() { //~ NOTE un-closed delimiter
+   |          - un-closed delimiter
+LL |   match Some(x) {
+   |                 - this delimiter might not be properly closed...
+...
+LL | }
+   | - ...as it matches this but it has different indentation
+...
+LL | fn main() {} //~ ERROR this file contains an un-closed delimiter
+   |                                                                  ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/issue-41155.rs b/src/test/ui/parser/issue-41155.rs
new file mode 100644
index 00000000000..7bd8506af90
--- /dev/null
+++ b/src/test/ui/parser/issue-41155.rs
@@ -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.
+
+impl S { //~ ERROR cannot find type
+    pub
+} //~ ERROR expected one of
+
+fn main() {}
diff --git a/src/test/ui/parser/issue-41155.stderr b/src/test/ui/parser/issue-41155.stderr
new file mode 100644
index 00000000000..5c1aae29c2f
--- /dev/null
+++ b/src/test/ui/parser/issue-41155.stderr
@@ -0,0 +1,17 @@
+error: expected one of `(`, `async`, `const`, `default`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `}`
+  --> $DIR/issue-41155.rs:13:1
+   |
+LL |     pub
+   |        - expected one of 9 possible tokens here
+LL | } //~ ERROR expected one of
+   | ^ unexpected token
+
+error[E0412]: cannot find type `S` in this scope
+  --> $DIR/issue-41155.rs:11:6
+   |
+LL | impl S { //~ ERROR cannot find type
+   |      ^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/parser/macro-incomplete-parse.rs b/src/test/ui/parser/macro-incomplete-parse.rs
new file mode 100644
index 00000000000..9b8fdaf9a25
--- /dev/null
+++ b/src/test/ui/parser/macro-incomplete-parse.rs
@@ -0,0 +1,39 @@
+// Copyright 2013 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.
+
+// compile-flags: -Z continue-parse-after-error
+
+macro_rules! ignored_item {
+    () => {
+        fn foo() {}
+        fn bar() {}
+        , //~ ERROR macro expansion ignores token `,`
+    }
+}
+
+macro_rules! ignored_expr {
+    () => ( 1,  //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,`
+
+            2 )
+}
+
+macro_rules! ignored_pat {
+    () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,`
+}
+
+ignored_item!();
+
+fn main() {
+    ignored_expr!();
+    match 1 {
+        ignored_pat!() => (),
+        _ => (),
+    }
+}
diff --git a/src/test/ui/parser/macro-incomplete-parse.stderr b/src/test/ui/parser/macro-incomplete-parse.stderr
new file mode 100644
index 00000000000..198730dc07a
--- /dev/null
+++ b/src/test/ui/parser/macro-incomplete-parse.stderr
@@ -0,0 +1,35 @@
+error: macro expansion ignores token `,` and any following
+  --> $DIR/macro-incomplete-parse.rs:17:9
+   |
+LL |         , //~ ERROR macro expansion ignores token `,`
+   |         ^
+   |
+note: caused by the macro expansion here; the usage of `ignored_item!` is likely invalid in item context
+  --> $DIR/macro-incomplete-parse.rs:31:1
+   |
+LL | ignored_item!();
+   | ^^^^^^^^^^^^^^^^
+
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,`
+  --> $DIR/macro-incomplete-parse.rs:22:14
+   |
+LL |     () => ( 1,  //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,`
+   |              ^ expected one of `.`, `;`, `?`, `}`, or an operator here
+...
+LL |     ignored_expr!();
+   |     ---------------- in this macro invocation
+
+error: macro expansion ignores token `,` and any following
+  --> $DIR/macro-incomplete-parse.rs:28:14
+   |
+LL |     () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,`
+   |              ^
+   |
+note: caused by the macro expansion here; the usage of `ignored_pat!` is likely invalid in pattern context
+  --> $DIR/macro-incomplete-parse.rs:36:9
+   |
+LL |         ignored_pat!() => (),
+   |         ^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/match-refactor-to-expr.rs b/src/test/ui/parser/match-refactor-to-expr.rs
new file mode 100644
index 00000000000..3c88608697a
--- /dev/null
+++ b/src/test/ui/parser/match-refactor-to-expr.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 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.
+
+// compile-flags: -Z parse-only
+
+fn main() {
+    let foo =
+        match
+        Some(4).unwrap_or_else(5)
+        //~^ NOTE expected one of `.`, `?`, `{`, or an operator here
+        ; //~ NOTE unexpected token
+        //~^ ERROR expected one of `.`, `?`, `{`, or an operator, found `;`
+
+    println!("{}", foo)
+}
diff --git a/src/test/ui/parser/match-refactor-to-expr.stderr b/src/test/ui/parser/match-refactor-to-expr.stderr
new file mode 100644
index 00000000000..ecca781684c
--- /dev/null
+++ b/src/test/ui/parser/match-refactor-to-expr.stderr
@@ -0,0 +1,13 @@
+error: expected one of `.`, `?`, `{`, or an operator, found `;`
+  --> $DIR/match-refactor-to-expr.rs:18:9
+   |
+LL |         match
+   |         ----- help: try removing this `match`
+LL |         Some(4).unwrap_or_else(5)
+   |                                  - expected one of `.`, `?`, `{`, or an operator here
+LL |         //~^ NOTE expected one of `.`, `?`, `{`, or an operator here
+LL |         ; //~ NOTE unexpected token
+   |         ^ unexpected token
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/raw/raw-literal-keywords.rs b/src/test/ui/parser/raw/raw-literal-keywords.rs
new file mode 100644
index 00000000000..f1bfbc95eb3
--- /dev/null
+++ b/src/test/ui/parser/raw/raw-literal-keywords.rs
@@ -0,0 +1,23 @@
+// Copyright 2018 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.
+
+// compile-flags: -Z parse-only
+
+fn test_if() {
+    r#if true { } //~ ERROR found `true`
+}
+
+fn test_struct() {
+    r#struct Test; //~ ERROR found `Test`
+}
+
+fn test_union() {
+    r#union Test; //~ ERROR found `Test`
+}
diff --git a/src/test/ui/parser/raw/raw-literal-keywords.stderr b/src/test/ui/parser/raw/raw-literal-keywords.stderr
new file mode 100644
index 00000000000..8a6b91b4b4b
--- /dev/null
+++ b/src/test/ui/parser/raw/raw-literal-keywords.stderr
@@ -0,0 +1,20 @@
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true`
+  --> $DIR/raw-literal-keywords.rs:14:10
+   |
+LL |     r#if true { } //~ ERROR found `true`
+   |          ^^^^ expected one of 8 possible tokens here
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
+  --> $DIR/raw-literal-keywords.rs:18:14
+   |
+LL |     r#struct Test; //~ ERROR found `Test`
+   |              ^^^^ expected one of 8 possible tokens here
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
+  --> $DIR/raw-literal-keywords.rs:22:13
+   |
+LL |     r#union Test; //~ ERROR found `Test`
+   |             ^^^^ expected one of 8 possible tokens here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/raw/raw-literal-self.rs b/src/test/ui/parser/raw/raw-literal-self.rs
new file mode 100644
index 00000000000..17496d767b6
--- /dev/null
+++ b/src/test/ui/parser/raw/raw-literal-self.rs
@@ -0,0 +1,15 @@
+// Copyright 2018 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.
+
+// compile-flags: -Z parse-only
+
+fn self_test(r#self: u32) {
+    //~^ ERROR `r#self` is not currently supported.
+}
diff --git a/src/test/ui/parser/raw/raw-literal-self.stderr b/src/test/ui/parser/raw/raw-literal-self.stderr
new file mode 100644
index 00000000000..f4b75937247
--- /dev/null
+++ b/src/test/ui/parser/raw/raw-literal-self.stderr
@@ -0,0 +1,8 @@
+error: `r#self` is not currently supported.
+  --> $DIR/raw-literal-self.rs:13:14
+   |
+LL | fn self_test(r#self: u32) {
+   |              ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/raw/raw-literal-underscore.rs b/src/test/ui/parser/raw/raw-literal-underscore.rs
new file mode 100644
index 00000000000..ec33e486195
--- /dev/null
+++ b/src/test/ui/parser/raw/raw-literal-underscore.rs
@@ -0,0 +1,15 @@
+// Copyright 2018 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.
+
+// compile-flags: -Z parse-only
+
+fn underscore_test(r#_: u32) {
+    //~^ ERROR `r#_` is not currently supported.
+}
diff --git a/src/test/ui/parser/raw/raw-literal-underscore.stderr b/src/test/ui/parser/raw/raw-literal-underscore.stderr
new file mode 100644
index 00000000000..8072eee4f06
--- /dev/null
+++ b/src/test/ui/parser/raw/raw-literal-underscore.stderr
@@ -0,0 +1,8 @@
+error: `r#_` is not currently supported.
+  --> $DIR/raw-literal-underscore.rs:13:20
+   |
+LL | fn underscore_test(r#_: u32) {
+   |                    ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/raw/raw_string.rs b/src/test/ui/parser/raw/raw_string.rs
new file mode 100644
index 00000000000..f1eb91d44fd
--- /dev/null
+++ b/src/test/ui/parser/raw/raw_string.rs
@@ -0,0 +1,14 @@
+// Copyright 2018 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.
+
+fn main() {
+    let x = r##"lol"#;
+    //~^ ERROR unterminated raw string
+}
diff --git a/src/test/ui/parser/raw/raw_string.stderr b/src/test/ui/parser/raw/raw_string.stderr
new file mode 100644
index 00000000000..ddf1cfe406f
--- /dev/null
+++ b/src/test/ui/parser/raw/raw_string.stderr
@@ -0,0 +1,10 @@
+error: unterminated raw string
+  --> $DIR/raw_string.rs:12:13
+   |
+LL |     let x = r##"lol"#;
+   |             ^ unterminated raw string
+   |
+   = note: this raw string should be terminated with `"##`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/trailing-plus-in-bounds.rs b/src/test/ui/parser/trailing-plus-in-bounds.rs
new file mode 100644
index 00000000000..72cae6abc2d
--- /dev/null
+++ b/src/test/ui/parser/trailing-plus-in-bounds.rs
@@ -0,0 +1,20 @@
+// Copyright 2012 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.
+
+// compile-flags: -Z parse-only -Z continue-parse-after-error
+
+use std::fmt::Debug;
+
+fn main() {
+    let x: Box<Debug+> = box 3 as Box<Debug+>; // Trailing `+` is OK
+}
+
+FAIL
+//~^ ERROR
diff --git a/src/test/ui/parser/trailing-plus-in-bounds.stderr b/src/test/ui/parser/trailing-plus-in-bounds.stderr
new file mode 100644
index 00000000000..1719b1d5e08
--- /dev/null
+++ b/src/test/ui/parser/trailing-plus-in-bounds.stderr
@@ -0,0 +1,8 @@
+error: expected one of `!` or `::`, found `<eof>`
+  --> $DIR/trailing-plus-in-bounds.rs:19:1
+   |
+LL | FAIL
+   | ^^^^ expected one of `!` or `::` here
+
+error: aborting due to previous error
+