about summary refs log tree commit diff
path: root/src/test/run-pass
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2018-11-04 04:47:10 +0000
committerAlexander Regueiro <alexreg@me.com>2018-11-07 21:57:40 +0000
commit0e89f570d224ee08b6e32aa9ea8ea44a4e9244f3 (patch)
treeb4608c47fb643d3b8955e272b3c322274f788ecc /src/test/run-pass
parentd08a42bf2c2115fc1869b3a72ee40fa4dd445795 (diff)
downloadrust-0e89f570d224ee08b6e32aa9ea8ea44a4e9244f3.tar.gz
rust-0e89f570d224ee08b6e32aa9ea8ea44a4e9244f3.zip
Added tests.
Diffstat (limited to 'src/test/run-pass')
-rw-r--r--src/test/run-pass/issues/issue-24010.rs22
-rw-r--r--src/test/run-pass/traits/trait-alias-objects.rs (renamed from src/test/run-pass/traits/trait-alias-object-type.rs)5
2 files changed, 24 insertions, 3 deletions
diff --git a/src/test/run-pass/issues/issue-24010.rs b/src/test/run-pass/issues/issue-24010.rs
new file mode 100644
index 00000000000..cce8bb84837
--- /dev/null
+++ b/src/test/run-pass/issues/issue-24010.rs
@@ -0,0 +1,22 @@
+// Copyright 2018 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 Foo: Fn(i32) -> i32 + Send {}
+
+impl<T: ?Sized + Fn(i32) -> i32 + Send> Foo for T {}
+
+fn wants_foo(f: Box<Foo>) -> i32 {
+    f(42)
+}
+
+fn main() {
+    let f = Box::new(|x| x);
+    assert_eq!(wants_foo(f), 42);
+}
diff --git a/src/test/run-pass/traits/trait-alias-object-type.rs b/src/test/run-pass/traits/trait-alias-objects.rs
index 17e30922b2c..a5bb0cac251 100644
--- a/src/test/run-pass/traits/trait-alias-object-type.rs
+++ b/src/test/run-pass/traits/trait-alias-objects.rs
@@ -21,7 +21,6 @@ pub fn main() {
     let b = Box::new(456) as Box<dyn Foo>;
     assert!(*b == 456);
 
-    // FIXME(alexreg): associated type should be gotten from trait alias definition
-    // let c: &dyn I32Iterator = &vec![123].into_iter();
-    // assert_eq!(c.next(), Some(123));
+    let c: &mut dyn I32Iterator<Item = u32> = &mut vec![123].into_iter();
+    assert_eq!(c.next(), Some(123));
 }