about summary refs log tree commit diff
path: root/src/test/compile-fail/object-does-not-impl-trait.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-03-05 17:49:50 -0500
committerNiko Matsakis <niko@alum.mit.edu>2013-03-06 11:02:19 -0500
commit6d764cc361b2e82f6ffead7bb7ddea18adf31481 (patch)
tree2847021a9128d699f6e618128d40a88024b782cb /src/test/compile-fail/object-does-not-impl-trait.rs
parent6267339d6869a27b95f13c578a235204a1562697 (diff)
downloadrust-6d764cc361b2e82f6ffead7bb7ddea18adf31481.tar.gz
rust-6d764cc361b2e82f6ffead7bb7ddea18adf31481.zip
Make object types not implement associated trait. Fixes #5087.
Diffstat (limited to 'src/test/compile-fail/object-does-not-impl-trait.rs')
-rw-r--r--src/test/compile-fail/object-does-not-impl-trait.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/compile-fail/object-does-not-impl-trait.rs b/src/test/compile-fail/object-does-not-impl-trait.rs
new file mode 100644
index 00000000000..886b849dbef
--- /dev/null
+++ b/src/test/compile-fail/object-does-not-impl-trait.rs
@@ -0,0 +1,17 @@
+// Copyright 2012 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 an object type `@Foo` is not considered to implement the
+// trait `Foo`. Issue #5087.
+
+trait Foo {}
+fn take_foo<F:Foo>(f: F) {}
+fn take_object(f: @Foo) { take_foo(f); } //~ ERROR failed to find an implementation of trait
+fn main() {}