about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/incremental/issue-59523-on-implemented-is-not-unused.rs27
-rw-r--r--src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs19
-rw-r--r--src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs10
-rw-r--r--src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs14
-rw-r--r--src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs9
-rw-r--r--src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs53
-rw-r--r--src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs20
-rw-r--r--src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs22
-rw-r--r--src/test/ui/deref-suggestion.rs18
-rw-r--r--src/test/ui/deref-suggestion.stderr56
-rw-r--r--src/test/ui/issues/issue-34334.rs8
-rw-r--r--src/test/ui/issues/issue-34334.stderr43
-rw-r--r--src/test/ui/parser/pat-tuple-1.rs2
-rw-r--r--src/test/ui/parser/pat-tuple-5.rs2
-rw-r--r--src/test/ui/parser/recover-from-bad-variant.rs14
-rw-r--r--src/test/ui/parser/recover-from-bad-variant.stderr23
-rw-r--r--src/test/ui/parser/recover-tuple-pat.rs12
-rw-r--r--src/test/ui/parser/recover-tuple-pat.stderr24
-rw-r--r--src/test/ui/parser/recover-tuple.rs11
-rw-r--r--src/test/ui/parser/recover-tuple.stderr18
-rw-r--r--src/test/ui/parser/trait-object-lifetime-parens.rs5
-rw-r--r--src/test/ui/parser/trait-object-lifetime-parens.stderr17
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/enum.rs44
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/enum_same_crate.rs (renamed from src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs)1
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/struct.rs (renamed from src/test/ui/rfc-2008-non-exhaustive/structs.rs)12
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/struct.stderr (renamed from src/test/ui/rfc-2008-non-exhaustive/structs.stderr)18
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/structs_same_crate.rs (renamed from src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs)1
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/variant.rs (renamed from src/test/ui/rfc-2008-non-exhaustive/variants.rs)25
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/variant.stderr52
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/variants_create.rs17
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr20
-rw-r--r--src/test/ui/rfc-2008-non-exhaustive/variants_same_crate.rs (renamed from src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs)7
32 files changed, 423 insertions, 201 deletions
diff --git a/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs b/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs
new file mode 100644
index 00000000000..3d16a1543f4
--- /dev/null
+++ b/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs
@@ -0,0 +1,27 @@
+// We should not see the unused_attributes lint fire for
+// rustc_on_unimplemented, but with this bug we are seeing it fire (on
+// subsequent runs) if incremental compilation is enabled.
+
+// revisions: rpass1 rpass2
+// compile-pass
+
+#![feature(on_unimplemented)]
+#![deny(unused_attributes)]
+
+#[rustc_on_unimplemented = "invalid"]
+trait Index<Idx: ?Sized> {
+    type Output: ?Sized;
+    fn index(&self, index: Idx) -> &Self::Output;
+}
+
+#[rustc_on_unimplemented = "a usize is required to index into a slice"]
+impl Index<usize> for [i32] {
+    type Output = i32;
+    fn index(&self, index: usize) -> &i32 {
+        &self[index]
+    }
+}
+
+fn main() {
+    Index::<usize>::index(&[1, 2, 3] as &[i32], 2);
+}
diff --git a/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs b/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs
new file mode 100644
index 00000000000..e4802cba9b6
--- /dev/null
+++ b/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs
@@ -0,0 +1,19 @@
+// We should not see the unused_attributes lint fire for
+// rustc_layout_scalar_valid_range_start, but with this bug we are
+// seeing it fire (on subsequent runs) if incremental compilation is
+// enabled.
+
+// revisions: rpass1 rpass2
+// compile-pass
+
+#![feature(rustc_attrs)]
+#![deny(unused_attributes)]
+
+#[rustc_layout_scalar_valid_range_start(10)]
+#[rustc_layout_scalar_valid_range_end(30)]
+struct RestrictedRange(u32);
+const OKAY_RANGE: RestrictedRange = unsafe { RestrictedRange(20) };
+
+fn main() {
+    OKAY_RANGE.0;
+}
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs
deleted file mode 100644
index b3e2fa2c620..00000000000
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-pass
-#![crate_type = "rlib"]
-#![feature(non_exhaustive)]
-
-#[non_exhaustive]
-pub enum NonExhaustiveEnum {
-    Unit,
-    Tuple(u32),
-    Struct { field: u32 }
-}
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs
deleted file mode 100644
index 08b14d0df94..00000000000
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-#![feature(non_exhaustive)]
-
-#[non_exhaustive]
-pub struct NormalStruct {
-    pub first_field: u16,
-    pub second_field: u16,
-}
-
-#[non_exhaustive]
-pub struct UnitStruct;
-
-#[non_exhaustive]
-pub struct TupleStruct (pub u16, pub u16);
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs
deleted file mode 100644
index 56a73d8ab60..00000000000
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-#![crate_type = "rlib"]
-#![feature(non_exhaustive)]
-
-pub enum NonExhaustiveVariants {
-    #[non_exhaustive] Unit,
-    #[non_exhaustive] Tuple(u32),
-    #[non_exhaustive] Struct { field: u32 }
-}
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs
deleted file mode 100644
index f7e9c538496..00000000000
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// run-pass
-// aux-build:enums.rs
-extern crate enums;
-
-// ignore-pretty issue #37199
-
-use enums::NonExhaustiveEnum;
-
-fn main() {
-    let enum_unit = NonExhaustiveEnum::Unit;
-
-    match enum_unit {
-        NonExhaustiveEnum::Unit => 1,
-        NonExhaustiveEnum::Tuple(_) => 2,
-        // This particular arm tests that a enum marked as non-exhaustive
-        // will not error if its variants are matched exhaustively.
-        NonExhaustiveEnum::Struct { field } => field,
-        _ => 0 // no error with wildcard
-    };
-
-    match enum_unit {
-        _ => "no error with only wildcard"
-    };
-
-
-    // issue #53549 - check that variant constructors can still be called normally.
-
-    match NonExhaustiveEnum::Unit {
-        NonExhaustiveEnum::Unit => {},
-        _ => {}
-    };
-
-    match NonExhaustiveEnum::Tuple(2) {
-        NonExhaustiveEnum::Tuple(2) => {},
-        _ => {}
-    };
-
-    match (NonExhaustiveEnum::Unit {}) {
-        NonExhaustiveEnum::Unit {} => {},
-        _ => {}
-    };
-
-    match (NonExhaustiveEnum::Tuple { 0: 2 }) {
-        NonExhaustiveEnum::Tuple { 0: 2 } => {},
-        _ => {}
-    };
-
-    match (NonExhaustiveEnum::Struct { field: 2 }) {
-        NonExhaustiveEnum::Struct { field: 2 } => {},
-        _ => {}
-    };
-
-}
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs
deleted file mode 100644
index 3cd7234269e..00000000000
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-#![allow(unused_variables)]
-// aux-build:structs.rs
-extern crate structs;
-
-use structs::{NormalStruct, UnitStruct, TupleStruct};
-
-// We only test matching here as we cannot create non-exhaustive
-// structs from another crate. ie. they'll never pass in run-pass tests.
-
-fn match_structs(ns: NormalStruct, ts: TupleStruct, us: UnitStruct) {
-    let NormalStruct { first_field, second_field, .. } = ns;
-
-    let TupleStruct { 0: first, 1: second, .. } = ts;
-
-    let UnitStruct { .. } = us;
-}
-
-fn main() { }
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs
deleted file mode 100644
index 90b8219e2a3..00000000000
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-// aux-build:variants.rs
-extern crate variants;
-
-use variants::NonExhaustiveVariants;
-
-/*
- * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for
- * variants. See issue #44109 and PR 45394.
- */
-// ignore-test
-
-fn main() {
-    let variant_tuple = NonExhaustiveVariants::Tuple { 0: 340 };
-    let variant_struct = NonExhaustiveVariants::Struct { field: 340 };
-
-    match variant_struct {
-        NonExhaustiveVariants::Unit => "",
-        NonExhaustiveVariants::Struct { field, .. } => "",
-        NonExhaustiveVariants::Tuple(fe_tpl, ..) => ""
-    };
-}
diff --git a/src/test/ui/deref-suggestion.rs b/src/test/ui/deref-suggestion.rs
index 83e54b64f47..580410aecf4 100644
--- a/src/test/ui/deref-suggestion.rs
+++ b/src/test/ui/deref-suggestion.rs
@@ -15,6 +15,14 @@ fn foo4(u: &u32) {
     //~^ ERROR mismatched types
 }
 
+struct S<'a> {
+    u: &'a u32,
+}
+
+struct R {
+    i: u32,
+}
+
 fn main() {
     let s = String::new();
     let r_s = &s;
@@ -27,4 +35,14 @@ fn main() {
     foo4(&0);
     assert_eq!(3i32, &3i32);
     //~^ ERROR mismatched types
+    let u = 3;
+    let s = S { u };
+    //~^ ERROR mismatched types
+    let s = S { u: u };
+    //~^ ERROR mismatched types
+    let i = &4;
+    let r = R { i };
+    //~^ ERROR mismatched types
+    let r = R { i: i };
+    //~^ ERROR mismatched types
 }
diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr
index 8f061b3416e..9c49f541c93 100644
--- a/src/test/ui/deref-suggestion.stderr
+++ b/src/test/ui/deref-suggestion.stderr
@@ -23,7 +23,7 @@ LL |     foo3(u);
               found type `&u32`
 
 error[E0308]: mismatched types
-  --> $DIR/deref-suggestion.rs:22:9
+  --> $DIR/deref-suggestion.rs:30:9
    |
 LL |     foo(&"aaa".to_owned());
    |         ^^^^^^^^^^^^^^^^^
@@ -35,7 +35,7 @@ LL |     foo(&"aaa".to_owned());
               found type `&std::string::String`
 
 error[E0308]: mismatched types
-  --> $DIR/deref-suggestion.rs:24:9
+  --> $DIR/deref-suggestion.rs:32:9
    |
 LL |     foo(&mut "aaa".to_owned());
    |         ^^^^^^^^^^^^^^^^^^^^^
@@ -59,7 +59,7 @@ LL |     foo3(borrow!(0));
               found type `&{integer}`
 
 error[E0308]: mismatched types
-  --> $DIR/deref-suggestion.rs:28:5
+  --> $DIR/deref-suggestion.rs:36:5
    |
 LL |     assert_eq!(3i32, &3i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32
@@ -68,6 +68,54 @@ LL |     assert_eq!(3i32, &3i32);
               found type `&i32`
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 
-error: aborting due to 6 previous errors
+error[E0308]: mismatched types
+  --> $DIR/deref-suggestion.rs:39:17
+   |
+LL |     let s = S { u };
+   |                 ^
+   |                 |
+   |                 expected &u32, found integer
+   |                 help: consider borrowing here: `u: &u`
+   |
+   = note: expected type `&u32`
+              found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/deref-suggestion.rs:41:20
+   |
+LL |     let s = S { u: u };
+   |                    ^
+   |                    |
+   |                    expected &u32, found integer
+   |                    help: consider borrowing here: `&u`
+   |
+   = note: expected type `&u32`
+              found type `{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/deref-suggestion.rs:44:17
+   |
+LL |     let r = R { i };
+   |                 ^
+   |                 |
+   |                 expected u32, found &{integer}
+   |                 help: consider dereferencing the borrow: `i: *i`
+   |
+   = note: expected type `u32`
+              found type `&{integer}`
+
+error[E0308]: mismatched types
+  --> $DIR/deref-suggestion.rs:46:20
+   |
+LL |     let r = R { i: i };
+   |                    ^
+   |                    |
+   |                    expected u32, found &{integer}
+   |                    help: consider dereferencing the borrow: `*i`
+   |
+   = note: expected type `u32`
+              found type `&{integer}`
+
+error: aborting due to 10 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issues/issue-34334.rs b/src/test/ui/issues/issue-34334.rs
index 5c4f5c86a7f..928d217441e 100644
--- a/src/test/ui/issues/issue-34334.rs
+++ b/src/test/ui/issues/issue-34334.rs
@@ -1,4 +1,10 @@
 fn main () {
-    let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=`
+    let sr: Vec<(u32, _, _) = vec![];
+    //~^ ERROR expected one of `,` or `>`, found `=`
+    //~| ERROR expected value, found struct `Vec`
+    //~| ERROR mismatched types
+    //~| ERROR invalid left-hand side expression
+    //~| ERROR expected expression, found reserved identifier `_`
     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
+    //~^ ERROR no method named `iter` found for type `()` in the current scope
 }
diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr
index 1b0babf9390..51ea0c6a908 100644
--- a/src/test/ui/issues/issue-34334.stderr
+++ b/src/test/ui/issues/issue-34334.stderr
@@ -1,10 +1,47 @@
+error: expected expression, found reserved identifier `_`
+  --> $DIR/issue-34334.rs:2:23
+   |
+LL |     let sr: Vec<(u32, _, _) = vec![];
+   |                       ^ expected expression
+
 error: expected one of `,` or `>`, found `=`
   --> $DIR/issue-34334.rs:2:29
    |
 LL |     let sr: Vec<(u32, _, _) = vec![];
-   |         --                  ^ expected one of `,` or `>` here
-   |         |
+   |         ---                 ^ expected one of `,` or `>` here
+   |         | |
+   |         | help: use `=` if you meant to assign
    |         while parsing the type for `sr`
 
-error: aborting due to previous error
+error[E0423]: expected value, found struct `Vec`
+  --> $DIR/issue-34334.rs:2:13
+   |
+LL |     let sr: Vec<(u32, _, _) = vec![];
+   |             ^^^ did you mean `Vec { /* fields */ }`?
+
+error[E0308]: mismatched types
+  --> $DIR/issue-34334.rs:2:31
+   |
+LL |     let sr: Vec<(u32, _, _) = vec![];
+   |                               ^^^^^^ expected bool, found struct `std::vec::Vec`
+   |
+   = note: expected type `bool`
+              found type `std::vec::Vec<_>`
+   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error[E0070]: invalid left-hand side expression
+  --> $DIR/issue-34334.rs:2:13
+   |
+LL |     let sr: Vec<(u32, _, _) = vec![];
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid
+
+error[E0599]: no method named `iter` found for type `()` in the current scope
+  --> $DIR/issue-34334.rs:8:36
+   |
+LL |     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
+   |                                    ^^^^
+
+error: aborting due to 6 previous errors
 
+Some errors occurred: E0070, E0308, E0423, E0599.
+For more information about an error, try `rustc --explain E0070`.
diff --git a/src/test/ui/parser/pat-tuple-1.rs b/src/test/ui/parser/pat-tuple-1.rs
index 213fbe371d4..0e49b547f7d 100644
--- a/src/test/ui/parser/pat-tuple-1.rs
+++ b/src/test/ui/parser/pat-tuple-1.rs
@@ -1,5 +1,5 @@
 fn main() {
-    match 0 {
+    match (0, 1) {
         (, ..) => {} //~ ERROR expected pattern, found `,`
     }
 }
diff --git a/src/test/ui/parser/pat-tuple-5.rs b/src/test/ui/parser/pat-tuple-5.rs
index 03176abaf49..d4f05a5eb52 100644
--- a/src/test/ui/parser/pat-tuple-5.rs
+++ b/src/test/ui/parser/pat-tuple-5.rs
@@ -1,5 +1,5 @@
 fn main() {
-    match 0 {
+    match (0, 1) {
         (pat ..) => {} //~ ERROR unexpected token: `)`
     }
 }
diff --git a/src/test/ui/parser/recover-from-bad-variant.rs b/src/test/ui/parser/recover-from-bad-variant.rs
new file mode 100644
index 00000000000..35088fb3068
--- /dev/null
+++ b/src/test/ui/parser/recover-from-bad-variant.rs
@@ -0,0 +1,14 @@
+enum Enum {
+    Foo { a: usize, b: usize },
+    Bar(usize, usize),
+}
+
+fn main() {
+    let x = Enum::Foo(a: 3, b: 4);
+    //~^ ERROR expected type, found `3`
+    match x {
+        Enum::Foo(a, b) => {}
+        //~^ ERROR expected tuple struct/variant, found struct variant `Enum::Foo`
+        Enum::Bar(a, b) => {}
+    }
+}
diff --git a/src/test/ui/parser/recover-from-bad-variant.stderr b/src/test/ui/parser/recover-from-bad-variant.stderr
new file mode 100644
index 00000000000..1eba6d7d528
--- /dev/null
+++ b/src/test/ui/parser/recover-from-bad-variant.stderr
@@ -0,0 +1,23 @@
+error: expected type, found `3`
+  --> $DIR/recover-from-bad-variant.rs:7:26
+   |
+LL |     let x = Enum::Foo(a: 3, b: 4);
+   |                          ^ expecting a type here because of type ascription
+   |
+   = note: type ascription is a nightly-only feature that lets you annotate an expression with a type: `<expr>: <type>`
+note: this expression expects an ascribed type after the colon
+  --> $DIR/recover-from-bad-variant.rs:7:23
+   |
+LL |     let x = Enum::Foo(a: 3, b: 4);
+   |                       ^
+   = help: this might be indicative of a syntax error elsewhere
+
+error[E0532]: expected tuple struct/variant, found struct variant `Enum::Foo`
+  --> $DIR/recover-from-bad-variant.rs:10:9
+   |
+LL |         Enum::Foo(a, b) => {}
+   |         ^^^^^^^^^ did you mean `Enum::Foo { /* fields */ }`?
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/ui/parser/recover-tuple-pat.rs b/src/test/ui/parser/recover-tuple-pat.rs
new file mode 100644
index 00000000000..488e8db6b87
--- /dev/null
+++ b/src/test/ui/parser/recover-tuple-pat.rs
@@ -0,0 +1,12 @@
+fn main() {
+    let x = (1, 2, 3, 4);
+    match x {
+        (1, .., 4) => {}
+        (1, .=., 4) => { let _: usize = ""; }
+        //~^ ERROR expected pattern, found `.`
+        //~| ERROR mismatched types
+        (.=., 4) => {}
+        //~^ ERROR expected pattern, found `.`
+        (1, 2, 3, 4) => {}
+    }
+}
diff --git a/src/test/ui/parser/recover-tuple-pat.stderr b/src/test/ui/parser/recover-tuple-pat.stderr
new file mode 100644
index 00000000000..5919aa72355
--- /dev/null
+++ b/src/test/ui/parser/recover-tuple-pat.stderr
@@ -0,0 +1,24 @@
+error: expected pattern, found `.`
+  --> $DIR/recover-tuple-pat.rs:5:13
+   |
+LL |         (1, .=., 4) => { let _: usize = ""; }
+   |             ^ expected pattern
+
+error: expected pattern, found `.`
+  --> $DIR/recover-tuple-pat.rs:8:10
+   |
+LL |         (.=., 4) => {}
+   |          ^ expected pattern
+
+error[E0308]: mismatched types
+  --> $DIR/recover-tuple-pat.rs:5:41
+   |
+LL |         (1, .=., 4) => { let _: usize = ""; }
+   |                                         ^^ expected usize, found reference
+   |
+   = note: expected type `usize`
+              found type `&'static str`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/recover-tuple.rs b/src/test/ui/parser/recover-tuple.rs
new file mode 100644
index 00000000000..59e2695dec6
--- /dev/null
+++ b/src/test/ui/parser/recover-tuple.rs
@@ -0,0 +1,11 @@
+fn main() {
+    // no complaints about the tuple not matching the expected type
+    let x: (usize, usize, usize) = (3, .=.);
+    //~^ ERROR expected expression, found `.`
+    // verify that the parser recovers:
+    let y: usize = ""; //~ ERROR mismatched types
+    // no complaints about the type
+    foo(x);
+}
+
+fn foo(_: (usize, usize, usize)) {}
diff --git a/src/test/ui/parser/recover-tuple.stderr b/src/test/ui/parser/recover-tuple.stderr
new file mode 100644
index 00000000000..4252fc1fd1e
--- /dev/null
+++ b/src/test/ui/parser/recover-tuple.stderr
@@ -0,0 +1,18 @@
+error: expected expression, found `.`
+  --> $DIR/recover-tuple.rs:3:40
+   |
+LL |     let x: (usize, usize, usize) = (3, .=.);
+   |                                        ^ expected expression
+
+error[E0308]: mismatched types
+  --> $DIR/recover-tuple.rs:6:20
+   |
+LL |     let y: usize = "";
+   |                    ^^ expected usize, found reference
+   |
+   = note: expected type `usize`
+              found type `&'static str`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/parser/trait-object-lifetime-parens.rs b/src/test/ui/parser/trait-object-lifetime-parens.rs
index b188e14778b..43f6497f7e7 100644
--- a/src/test/ui/parser/trait-object-lifetime-parens.rs
+++ b/src/test/ui/parser/trait-object-lifetime-parens.rs
@@ -6,7 +6,10 @@ fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not s
 
 fn check<'a>() {
     let _: Box<Trait + ('a)>; //~ ERROR parenthesized lifetime bounds are not supported
-    let _: Box<('a) + Trait>; //~ ERROR expected type, found `'a`
+    let _: Box<('a) + Trait>;
+    //~^ ERROR expected type, found `'a`
+    //~| ERROR expected `:`, found `)`
+    //~| ERROR chained comparison operators require parentheses
 }
 
 fn main() {}
diff --git a/src/test/ui/parser/trait-object-lifetime-parens.stderr b/src/test/ui/parser/trait-object-lifetime-parens.stderr
index 084e6d5b11f..a31b7aea8fe 100644
--- a/src/test/ui/parser/trait-object-lifetime-parens.stderr
+++ b/src/test/ui/parser/trait-object-lifetime-parens.stderr
@@ -10,6 +10,21 @@ error: parenthesized lifetime bounds are not supported
 LL |     let _: Box<Trait + ('a)>;
    |                        ^^^^ help: remove the parentheses
 
+error: expected `:`, found `)`
+  --> $DIR/trait-object-lifetime-parens.rs:9:19
+   |
+LL |     let _: Box<('a) + Trait>;
+   |                   ^ expected `:`
+
+error: chained comparison operators require parentheses
+  --> $DIR/trait-object-lifetime-parens.rs:9:15
+   |
+LL |     let _: Box<('a) + Trait>;
+   |               ^^^^^^^^^^^^^^^
+   |
+   = help: use `::<...>` instead of `<...>` if you meant to specify type arguments
+   = help: or use `(...)` if you meant to specify fn arguments
+
 error: expected type, found `'a`
   --> $DIR/trait-object-lifetime-parens.rs:9:17
    |
@@ -18,5 +33,5 @@ LL |     let _: Box<('a) + Trait>;
    |         |
    |         while parsing the type for `_`
 
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.rs b/src/test/ui/rfc-2008-non-exhaustive/enum.rs
index d9b1a989510..7423a970e2e 100644
--- a/src/test/ui/rfc-2008-non-exhaustive/enum.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/enum.rs
@@ -12,4 +12,48 @@ fn main() {
         NonExhaustiveEnum::Tuple(_) => "second",
         NonExhaustiveEnum::Struct { .. } => "third"
     };
+
+    // Everything below this is expected to compile successfully.
+
+    let enum_unit = NonExhaustiveEnum::Unit;
+
+    match enum_unit {
+        NonExhaustiveEnum::Unit => 1,
+        NonExhaustiveEnum::Tuple(_) => 2,
+        // This particular arm tests that a enum marked as non-exhaustive
+        // will not error if its variants are matched exhaustively.
+        NonExhaustiveEnum::Struct { field } => field,
+        _ => 0 // no error with wildcard
+    };
+
+    match enum_unit {
+        _ => "no error with only wildcard"
+    };
+
+    // #53549: Check that variant constructors can still be called normally.
+    match NonExhaustiveEnum::Unit {
+        NonExhaustiveEnum::Unit => {},
+        _ => {}
+    };
+
+    match NonExhaustiveEnum::Tuple(2) {
+        NonExhaustiveEnum::Tuple(2) => {},
+        _ => {}
+    };
+
+    match (NonExhaustiveEnum::Unit {}) {
+        NonExhaustiveEnum::Unit {} => {},
+        _ => {}
+    };
+
+    match (NonExhaustiveEnum::Tuple { 0: 2 }) {
+        NonExhaustiveEnum::Tuple { 0: 2 } => {},
+        _ => {}
+    };
+
+    match (NonExhaustiveEnum::Struct { field: 2 }) {
+        NonExhaustiveEnum::Struct { field: 2 } => {},
+        _ => {}
+    };
+
 }
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate.rs
index 384e099275e..a3626bf60b2 100644
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate.rs
@@ -1,4 +1,5 @@
 // run-pass
+
 #![feature(non_exhaustive)]
 
 #[non_exhaustive]
diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.rs b/src/test/ui/rfc-2008-non-exhaustive/struct.rs
index 303d71d12df..94ac588d240 100644
--- a/src/test/ui/rfc-2008-non-exhaustive/structs.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/struct.rs
@@ -35,3 +35,15 @@ fn main() {
     let UnitStruct { } = us;
     //~^ ERROR `..` required with struct marked as non-exhaustive
 }
+
+// Everything below this is expected to compile successfully.
+
+// We only test matching here as we cannot create non-exhaustive
+// structs from another crate. ie. they'll never pass in run-pass tests.
+fn match_structs(ns: NormalStruct, ts: TupleStruct, us: UnitStruct) {
+    let NormalStruct { first_field, second_field, .. } = ns;
+
+    let TupleStruct { 0: first, 1: second, .. } = ts;
+
+    let UnitStruct { .. } = us;
+}
diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr b/src/test/ui/rfc-2008-non-exhaustive/struct.stderr
index 6213c392a9b..ecfad88a825 100644
--- a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr
+++ b/src/test/ui/rfc-2008-non-exhaustive/struct.stderr
@@ -1,29 +1,29 @@
 error[E0423]: expected function, found struct `TupleStruct`
-  --> $DIR/structs.rs:20:14
+  --> $DIR/struct.rs:20:14
    |
 LL |     let ts = TupleStruct(640, 480);
    |              ^^^^^^^^^^^ constructor is not visible here due to private fields
 
 error[E0423]: expected value, found struct `UnitStruct`
-  --> $DIR/structs.rs:29:14
+  --> $DIR/struct.rs:29:14
    |
 LL |     let us = UnitStruct;
    |              ^^^^^^^^^^ constructor is not visible here due to private fields
 
 error[E0603]: tuple struct `TupleStruct` is private
-  --> $DIR/structs.rs:23:32
+  --> $DIR/struct.rs:23:32
    |
 LL |     let ts_explicit = structs::TupleStruct(640, 480);
    |                                ^^^^^^^^^^^
 
 error[E0603]: unit struct `UnitStruct` is private
-  --> $DIR/structs.rs:32:32
+  --> $DIR/struct.rs:32:32
    |
 LL |     let us_explicit = structs::UnitStruct;
    |                                ^^^^^^^^^^
 
 error[E0639]: cannot create non-exhaustive struct using struct expression
-  --> $DIR/structs.rs:7:14
+  --> $DIR/struct.rs:7:14
    |
 LL |       let fr = FunctionalRecord {
    |  ______________^
@@ -35,25 +35,25 @@ LL | |     };
    | |_____^
 
 error[E0639]: cannot create non-exhaustive struct using struct expression
-  --> $DIR/structs.rs:14:14
+  --> $DIR/struct.rs:14:14
    |
 LL |     let ns = NormalStruct { first_field: 640, second_field: 480 };
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0638]: `..` required with struct marked as non-exhaustive
-  --> $DIR/structs.rs:17:9
+  --> $DIR/struct.rs:17:9
    |
 LL |     let NormalStruct { first_field, second_field } = ns;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0638]: `..` required with struct marked as non-exhaustive
-  --> $DIR/structs.rs:26:9
+  --> $DIR/struct.rs:26:9
    |
 LL |     let TupleStruct { 0: first_field, 1: second_field } = ts;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0638]: `..` required with struct marked as non-exhaustive
-  --> $DIR/structs.rs:35:9
+  --> $DIR/struct.rs:35:9
    |
 LL |     let UnitStruct { } = us;
    |         ^^^^^^^^^^^^^^
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs b/src/test/ui/rfc-2008-non-exhaustive/structs_same_crate.rs
index 5e71cce1297..2b1d7d9ac50 100644
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/structs_same_crate.rs
@@ -1,4 +1,5 @@
 // run-pass
+
 #![allow(unused_variables)]
 #![feature(non_exhaustive)]
 
diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants.rs b/src/test/ui/rfc-2008-non-exhaustive/variant.rs
index 373bbc3547f..bc346aea51c 100644
--- a/src/test/ui/rfc-2008-non-exhaustive/variants.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/variant.rs
@@ -1,26 +1,33 @@
 // aux-build:variants.rs
+
 extern crate variants;
 
 use variants::NonExhaustiveVariants;
 
-/*
- * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for
- * variants. See issue #44109 and PR 45394.
- */
-// ignore-test
-
 fn main() {
     let variant_struct = NonExhaustiveVariants::Struct { field: 640 };
     //~^ ERROR cannot create non-exhaustive variant
 
-    let variant_tuple = NonExhaustiveVariants::Tuple { 0: 640 };
-    //~^ ERROR cannot create non-exhaustive variant
+    let variant_tuple = NonExhaustiveVariants::Tuple(640);
+    //~^ ERROR tuple variant `Tuple` is private [E0603]
+
+    let variant_unit = NonExhaustiveVariants::Unit;
+    //~^ ERROR unit variant `Unit` is private [E0603]
 
     match variant_struct {
         NonExhaustiveVariants::Unit => "",
+        //~^ ERROR unit variant `Unit` is private [E0603]
         NonExhaustiveVariants::Tuple(fe_tpl) => "",
-        //~^ ERROR `..` required with variant marked as non-exhaustive
+        //~^ ERROR tuple variant `Tuple` is private [E0603]
         NonExhaustiveVariants::Struct { field } => ""
         //~^ ERROR `..` required with variant marked as non-exhaustive
     };
+
+    if let NonExhaustiveVariants::Tuple(fe_tpl) = variant_struct {
+        //~^ ERROR tuple variant `Tuple` is private [E0603]
+    }
+
+    if let NonExhaustiveVariants::Struct { field } = variant_struct {
+        //~^ ERROR `..` required with variant marked as non-exhaustive
+    }
 }
diff --git a/src/test/ui/rfc-2008-non-exhaustive/variant.stderr b/src/test/ui/rfc-2008-non-exhaustive/variant.stderr
new file mode 100644
index 00000000000..edfca789150
--- /dev/null
+++ b/src/test/ui/rfc-2008-non-exhaustive/variant.stderr
@@ -0,0 +1,52 @@
+error[E0603]: tuple variant `Tuple` is private
+  --> $DIR/variant.rs:11:48
+   |
+LL |     let variant_tuple = NonExhaustiveVariants::Tuple(640);
+   |                                                ^^^^^
+
+error[E0603]: unit variant `Unit` is private
+  --> $DIR/variant.rs:14:47
+   |
+LL |     let variant_unit = NonExhaustiveVariants::Unit;
+   |                                               ^^^^
+
+error[E0603]: unit variant `Unit` is private
+  --> $DIR/variant.rs:18:32
+   |
+LL |         NonExhaustiveVariants::Unit => "",
+   |                                ^^^^
+
+error[E0603]: tuple variant `Tuple` is private
+  --> $DIR/variant.rs:20:32
+   |
+LL |         NonExhaustiveVariants::Tuple(fe_tpl) => "",
+   |                                ^^^^^
+
+error[E0603]: tuple variant `Tuple` is private
+  --> $DIR/variant.rs:26:35
+   |
+LL |     if let NonExhaustiveVariants::Tuple(fe_tpl) = variant_struct {
+   |                                   ^^^^^
+
+error[E0639]: cannot create non-exhaustive variant using struct expression
+  --> $DIR/variant.rs:8:26
+   |
+LL |     let variant_struct = NonExhaustiveVariants::Struct { field: 640 };
+   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0638]: `..` required with variant marked as non-exhaustive
+  --> $DIR/variant.rs:22:9
+   |
+LL |         NonExhaustiveVariants::Struct { field } => ""
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0638]: `..` required with variant marked as non-exhaustive
+  --> $DIR/variant.rs:30:12
+   |
+LL |     if let NonExhaustiveVariants::Struct { field } = variant_struct {
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0603, E0638, E0639.
+For more information about an error, try `rustc --explain E0603`.
diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs b/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs
deleted file mode 100644
index 9ed244144df..00000000000
--- a/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![feature(non_exhaustive)]
-
-/*
- * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for
- * variants. See issue #44109 and PR 45394.
- */
-
-pub enum NonExhaustiveVariants {
-    #[non_exhaustive] Unit,
-    //~^ ERROR #[non_exhaustive] is not yet supported on variants
-    #[non_exhaustive] Tuple(u32),
-    //~^ ERROR #[non_exhaustive] is not yet supported on variants
-    #[non_exhaustive] Struct { field: u32 }
-    //~^ ERROR #[non_exhaustive] is not yet supported on variants
-}
-
-fn main() { }
diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr b/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr
deleted file mode 100644
index 5b099d58ec4..00000000000
--- a/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error: #[non_exhaustive] is not yet supported on variants
-  --> $DIR/variants_create.rs:9:23
-   |
-LL |     #[non_exhaustive] Unit,
-   |                       ^^^^
-
-error: #[non_exhaustive] is not yet supported on variants
-  --> $DIR/variants_create.rs:11:23
-   |
-LL |     #[non_exhaustive] Tuple(u32),
-   |                       ^^^^^^^^^^
-
-error: #[non_exhaustive] is not yet supported on variants
-  --> $DIR/variants_create.rs:13:23
-   |
-LL |     #[non_exhaustive] Struct { field: u32 }
-   |                       ^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
-
diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs b/src/test/ui/rfc-2008-non-exhaustive/variants_same_crate.rs
index 603e69b9ff9..470a5ea9833 100644
--- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs
+++ b/src/test/ui/rfc-2008-non-exhaustive/variants_same_crate.rs
@@ -1,11 +1,6 @@
 // run-pass
-#![feature(non_exhaustive)]
 
-/*
- * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for
- * variants. See issue #44109 and PR 45394.
- */
-// ignore-test
+#![feature(non_exhaustive)]
 
 pub enum NonExhaustiveVariants {
     #[non_exhaustive] Unit,