summaryrefslogtreecommitdiffstats
path: root/src/test/ui/object-safety/object-safety-by-value-self-use.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/object-safety/object-safety-by-value-self-use.rs')
-rw-r--r--src/test/ui/object-safety/object-safety-by-value-self-use.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs
new file mode 100644
index 000000000..8e93c5382
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-by-value-self-use.rs
@@ -0,0 +1,18 @@
+// Check that while a trait with by-value self is object-safe, we
+// can't actually invoke it from an object (yet...?).
+
+#![feature(rustc_attrs)]
+
+trait Bar {
+ fn bar(self);
+}
+
+trait Baz {
+ fn baz(self: Self);
+}
+
+fn use_bar(t: Box<dyn Bar>) {
+ t.bar() //~ ERROR cannot move a value of type `dyn Bar`
+}
+
+fn main() { }