about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authortoidiu <toidiu@protonmail.com>2017-09-27 21:20:44 -0400
committertoidiu <toidiu@protonmail.com>2017-10-16 14:26:17 -0400
commitc021e5303f7db901a962b7c650ad5b2206801d9c (patch)
tree62969f7fc4431a48e02809cd3e7adbdb1c96326d /src/test
parentba1efa3b61759384fc39ad262cffb0a007b87f95 (diff)
downloadrust-c021e5303f7db901a962b7c650ad5b2206801d9c.tar.gz
rust-c021e5303f7db901a962b7c650ad5b2206801d9c.zip
add a test case
dont duplicate error codes

choose unlikely error code

specify error pattern in test
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/outlives-associated-types.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/compile-fail/outlives-associated-types.rs b/src/test/compile-fail/outlives-associated-types.rs
new file mode 100644
index 00000000000..f742ca81bcc
--- /dev/null
+++ b/src/test/compile-fail/outlives-associated-types.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// Test that the outlives computation runs for now...
+
+#![feature(rustc_attrs)]
+
+//todo add all the test cases
+// https://github.com/rust-lang/rfcs/blob/master/text/2093-infer-outlives.md#example-1-a-reference
+
+#[rustc_outlives]
+struct Direct<'a, T> {
+    // inferred: `T: 'a`
+    field: &'a T //~ ERROR generic reference may outlive the data it points to
+}
+
+fn main() { }