about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-01-18 17:41:57 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-01-24 22:56:02 +0300
commita8f5047430aa78c2d1ff30b5960cdbde24daab84 (patch)
tree482112ce6b38bbd2f66fb5f34874664612d90a3d /src/test/compile-fail
parentb795abeb1dc0f6d27e49d980a48936b687754b28 (diff)
downloadrust-a8f5047430aa78c2d1ff30b5960cdbde24daab84.tar.gz
rust-a8f5047430aa78c2d1ff30b5960cdbde24daab84.zip
Add tests
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/impl-trait/no-trait.rs15
-rw-r--r--src/test/compile-fail/where-equality-constraints.rs16
-rw-r--r--src/test/compile-fail/where-lifetime-resolution.rs23
3 files changed, 54 insertions, 0 deletions
diff --git a/src/test/compile-fail/impl-trait/no-trait.rs b/src/test/compile-fail/impl-trait/no-trait.rs
new file mode 100644
index 00000000000..ce61c5bf63d
--- /dev/null
+++ b/src/test/compile-fail/impl-trait/no-trait.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.
+
+#![feature(conservative_impl_trait)]
+
+fn f() -> impl 'static {} //~ ERROR at least one trait must be specified
+
+fn main() {}
diff --git a/src/test/compile-fail/where-equality-constraints.rs b/src/test/compile-fail/where-equality-constraints.rs
new file mode 100644
index 00000000000..5b2fe2901c4
--- /dev/null
+++ b/src/test/compile-fail/where-equality-constraints.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.
+
+fn f() where u8 = u16 {}
+//~^ ERROR equality constraints are not yet supported in where clauses
+fn g() where for<'a> &(u8,) == u16, {}
+//~^ ERROR equality constraints are not yet supported in where clauses
+
+fn main() {}
diff --git a/src/test/compile-fail/where-lifetime-resolution.rs b/src/test/compile-fail/where-lifetime-resolution.rs
new file mode 100644
index 00000000000..f4c6842206d
--- /dev/null
+++ b/src/test/compile-fail/where-lifetime-resolution.rs
@@ -0,0 +1,23 @@
+// 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.
+
+trait Trait1 {}
+trait Trait2 {}
+
+fn f() where
+    for<'a> Trait1<'a>: Trait1<'a>, // OK
+    (for<'a> Trait1<'a>): Trait1<'a>,
+    //~^ ERROR use of undeclared lifetime name `'a`
+    for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>,
+    //~^ ERROR use of undeclared lifetime name `'b`
+    //~| ERROR nested quantification of lifetimes
+{}
+
+fn main() {}