about summary refs log tree commit diff
path: root/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-02-17 10:32:25 -0500
committerNiko Matsakis <niko@alum.mit.edu>2017-02-17 11:01:35 -0500
commit5167ac87199cbf58d9cc46e3ba34dd3d75c88e4c (patch)
treeb6125521b19a548388cf8cac9dd09cc254ea7d01 /src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs
parentdc0bb3f2839c13ab42feacd423f728fbfd2f2f7a (diff)
downloadrust-5167ac87199cbf58d9cc46e3ba34dd3d75c88e4c.tar.gz
rust-5167ac87199cbf58d9cc46e3ba34dd3d75c88e4c.zip
add some sample UI error test cases
These are some samples that I have been focusing on improving over
time. In this PR, I mainly want to stem the bleeding where we in some
cases we show an error that gives you no possible way to divine the
problem.
Diffstat (limited to 'src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs')
-rw-r--r--src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs
new file mode 100644
index 00000000000..2d05adb7ecd
--- /dev/null
+++ b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs
@@ -0,0 +1,21 @@
+// 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 Ref<'a, T: 'a> {
+    data: &'a T
+}
+
+fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
+    let a: &mut Vec<Ref<i32>> = x;
+    let b = Ref { data: y.data };
+    Vec::push(a, b);
+}
+
+fn main() { }