summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsized-locals/by-value-trait-object-safety.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unsized-locals/by-value-trait-object-safety.rs')
-rw-r--r--src/test/ui/unsized-locals/by-value-trait-object-safety.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety.rs b/src/test/ui/unsized-locals/by-value-trait-object-safety.rs
new file mode 100644
index 000000000..d0ba6944a
--- /dev/null
+++ b/src/test/ui/unsized-locals/by-value-trait-object-safety.rs
@@ -0,0 +1,22 @@
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete
+
+pub trait Foo {
+ fn foo(self) -> String
+ where
+ Self: Sized;
+}
+
+struct A;
+
+impl Foo for A {
+ fn foo(self) -> String {
+ format!("hello")
+ }
+}
+
+fn main() {
+ let x = *(Box::new(A) as Box<dyn Foo>);
+ x.foo();
+ //~^ERROR the `foo` method cannot be invoked on a trait object
+}