about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-09-15 00:51:46 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-10-05 12:22:26 +0300
commitb3cb8f68cc54e2b3d81c1d235bccc4a2b1542fb7 (patch)
tree7bfa8aa01f2a95cf4b4d6193b53cdf2df37da47a /src/test
parent165a03d98376622024b87bfc2d37d40fd6370a90 (diff)
downloadrust-b3cb8f68cc54e2b3d81c1d235bccc4a2b1542fb7.tar.gz
rust-b3cb8f68cc54e2b3d81c1d235bccc4a2b1542fb7.zip
Turn compatibility lint `match_of_unit_variant_via_paren_dotdot` into a hard error
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/empty-struct-unit-pat-2.rs50
-rw-r--r--src/test/compile-fail/empty-struct-unit-pat.rs (renamed from src/test/compile-fail/empty-struct-unit-pat-1.rs)23
-rw-r--r--src/test/compile-fail/issue-pr29383.rs (renamed from src/test/run-pass/issue-pr29383.rs)6
3 files changed, 18 insertions, 61 deletions
diff --git a/src/test/compile-fail/empty-struct-unit-pat-2.rs b/src/test/compile-fail/empty-struct-unit-pat-2.rs
deleted file mode 100644
index 993f10e0806..00000000000
--- a/src/test/compile-fail/empty-struct-unit-pat-2.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-// Can't use unit struct as enum pattern
-
-// aux-build:empty-struct.rs
-
-#![feature(relaxed_adts)]
-
-extern crate empty_struct;
-use empty_struct::*;
-
-struct Empty2;
-
-enum E {
-    Empty4
-}
-
-fn main() {
-    let e2 = Empty2;
-    let e4 = E::Empty4;
-    let xe2 = XEmpty2;
-    let xe4 = XE::XEmpty4;
-
-    match e2 {
-        Empty2() => ()
-        //~^ ERROR expected tuple struct/variant, found unit struct `Empty2`
-    }
-    match xe2 {
-        XEmpty2() => ()
-        //~^ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
-    }
-
-    match e4 {
-        E::Empty4() => ()
-        //~^ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
-    }
-    match xe4 {
-        XE::XEmpty4() => (),
-        //~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
-        _ => {},
-    }
-}
diff --git a/src/test/compile-fail/empty-struct-unit-pat-1.rs b/src/test/compile-fail/empty-struct-unit-pat.rs
index 273cb48b2d2..90f6ae5755f 100644
--- a/src/test/compile-fail/empty-struct-unit-pat-1.rs
+++ b/src/test/compile-fail/empty-struct-unit-pat.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Can't use unit struct as enum pattern
+// Can't use unit struct as tuple struct pattern
 
 // aux-build:empty-struct.rs
 
@@ -23,7 +23,6 @@ enum E {
     Empty4
 }
 
-// remove attribute after warning cycle and promoting warnings to errors
 fn main() {
     let e2 = Empty2;
     let e4 = E::Empty4;
@@ -31,22 +30,32 @@ fn main() {
     let xe4 = XE::XEmpty4;
 
     match e2 {
+        Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
+    }
+    match xe2 {
+        XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
+    }
+    match e2 {
         Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
-            //~^ WARNING hard error
     }
     match xe2 {
         XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
-            //~^ WARNING hard error
     }
 
     match e4 {
+        E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
+    }
+    match xe4 {
+        XE::XEmpty4() => (),
+        //~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
+        _ => {},
+    }
+    match e4 {
         E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
-            //~^ WARNING hard error
     }
     match xe4 {
         XE::XEmpty4(..) => (),
-            //~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
-            //~| WARNING hard error
+        //~^ ERROR expected tuple struct/variant, found unit variant `XE::XEmpty4`
         _ => {},
     }
 }
diff --git a/src/test/run-pass/issue-pr29383.rs b/src/test/compile-fail/issue-pr29383.rs
index defb2c164da..b60c537e1e6 100644
--- a/src/test/run-pass/issue-pr29383.rs
+++ b/src/test/compile-fail/issue-pr29383.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![allow(match_of_unit_variant_via_paren_dotdot)]
-
 enum E {
     A,
     B,
@@ -18,7 +16,7 @@ enum E {
 fn main() {
     match None {
         None => {}
-        Some(E::A(..)) => {}
-        Some(E::B(..)) => {}
+        Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A`
+        Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B`
     }
 }