about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <aochagavia92@gmail.com>2014-10-27 12:15:03 +0100
committerAdolfo OchagavĂ­a <aochagavia92@gmail.com>2014-10-27 16:28:24 +0100
commit2ce77b33b04c64d57bef696d88605d08dff72775 (patch)
treee908d507eb7ea83137a1885acceec401f8bb1a01
parent9dab88712f68d79ec81d87deb433094a3b9d0013 (diff)
downloadrust-2ce77b33b04c64d57bef696d88605d08dff72775.tar.gz
rust-2ce77b33b04c64d57bef696d88605d08dff72775.zip
Add test for issue 18343
-rw-r--r--src/test/compile-fail/issue-18343.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-18343.rs b/src/test/compile-fail/issue-18343.rs
new file mode 100644
index 00000000000..1608d2137fc
--- /dev/null
+++ b/src/test/compile-fail/issue-18343.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 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 Obj<'a> {
+    closure: ||: 'a -> u32
+}
+
+fn main() {
+    let o = Obj { closure: || 42 };
+    o.closure(); //~ ERROR type `Obj<'_>` does not implement any method in scope named `closure`
+    //~^ NOTE use `(s.closure)(...)` if you meant to call the function stored in the `closure` field
+}