]> git.lizzy.rs Git - rust.git/commitdiff
Add tests
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Fri, 3 Jun 2016 20:15:00 +0000 (23:15 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Thu, 9 Jun 2016 22:03:54 +0000 (01:03 +0300)
src/test/compile-fail-fulldeps/issue-18986.rs
src/test/compile-fail/issue-32086.rs [new file with mode: 0644]
src/test/compile-fail/issue-34047.rs [new file with mode: 0644]
src/test/run-pass/issue-34074.rs [new file with mode: 0644]

index 5f7752bb203c2574da6986722d4ce348665c272e..4245786295b343fa14df160e11f5d447a65483be 100644 (file)
@@ -15,6 +15,7 @@
 
 fn main() {
     match () {
-        Trait { x: 42 } => () //~ ERROR `Trait` does not name a struct
+        Trait { x: 42 } => () //~ ERROR expected variant, struct or type alias, found trait `Trait`
+        //~^ ERROR `Trait` does not name a struct or a struct variant
     }
 }
diff --git a/src/test/compile-fail/issue-32086.rs b/src/test/compile-fail/issue-32086.rs
new file mode 100644 (file)
index 0000000..926f581
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 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.
+
+struct S(u8);
+const C: S = S(10);
+
+fn main() {
+    let C(a) = S(11); //~ ERROR expected variant or struct, found constant `C`
+    let C(..) = S(11); //~ ERROR expected variant or struct, found constant `C`
+}
diff --git a/src/test/compile-fail/issue-34047.rs b/src/test/compile-fail/issue-34047.rs
new file mode 100644 (file)
index 0000000..630694d
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 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.
+
+const C: u8 = 0; //~ NOTE a constant `C` is defined here
+
+fn main() {
+    match 1u8 {
+        mut C => {} //~ ERROR match bindings cannot shadow constants
+        //~^ NOTE cannot be named the same as a constant
+        _ => {}
+    }
+}
diff --git a/src/test/run-pass/issue-34074.rs b/src/test/run-pass/issue-34074.rs
new file mode 100644 (file)
index 0000000..169a87f
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright 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.
+
+// Make sure several unnamed function arguments don't conflict with each other
+
+trait Tr {
+    fn f(u8, u8) {}
+}
+
+fn main() {
+}