about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2017-03-26 14:15:47 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2017-03-26 14:38:23 +0300
commit7e0f7a50ab649fb70773af35e78ca73b5123f52e (patch)
treefd3de4e03024db58e4a2a63f0354722041c64bc9 /src/test/compile-fail
parent49c67bd632e961a57863805e5d0a400f97da9b93 (diff)
downloadrust-7e0f7a50ab649fb70773af35e78ca73b5123f52e.tar.gz
rust-7e0f7a50ab649fb70773af35e78ca73b5123f52e.zip
store a copy of the Issue32230 info within TypeError
The data can't be looked up from the region variable directly, because
the region variable might have been destroyed at the end of a snapshot.

Fixes #40000.
Fixes #40743.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-40000.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-40000.rs b/src/test/compile-fail/issue-40000.rs
new file mode 100644
index 00000000000..9be114ebcb6
--- /dev/null
+++ b/src/test/compile-fail/issue-40000.rs
@@ -0,0 +1,21 @@
+// 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(closure_to_fn_coercion)]
+
+fn main() {
+    let bar: fn(&mut u32) = |_| {}; //~ ERROR mismatched types
+    //~| expected concrete lifetime, found bound lifetime parameter
+
+    fn foo(x: Box<Fn(&i32)>) {}
+    let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
+    foo(bar); //~ ERROR mismatched types
+    //~| expected concrete lifetime, found bound lifetime parameter
+}