]> git.lizzy.rs Git - rust.git/commitdiff
Add autoderef tests for by-value trait objects.
authorMasaki Hara <ackie.h.gmai@gmail.com>
Wed, 24 Oct 2018 14:18:15 +0000 (23:18 +0900)
committerMasaki Hara <ackie.h.gmai@gmail.com>
Wed, 24 Oct 2018 14:18:15 +0000 (23:18 +0900)
src/test/run-pass/unsized-locals/by-value-trait-object-safety-withdefault.rs
src/test/run-pass/unsized-locals/by-value-trait-object-safety.rs

index b2d228b4da301ed1970f7a5bf795947510d03bac..9fcc4292a8a45635c5e9aafc1523afba77698377 100644 (file)
@@ -24,4 +24,8 @@ impl Foo for A {}
 fn main() {
     let x = *(Box::new(A) as Box<dyn Foo>);
     assert_eq!(x.foo(), format!("hello"));
+
+    // I'm not sure whether we want this to work
+    let x = Box::new(A) as Box<dyn Foo>;
+    assert_eq!(x.foo(), format!("hello"));
 }
index 2912df7ce075e3047e9673c120de2a46a1377376..0dd2d14a7a92fee339a2a09284c233652d8aa561 100644 (file)
@@ -26,4 +26,8 @@ fn foo(self) -> String {
 fn main() {
     let x = *(Box::new(A) as Box<dyn Foo>);
     assert_eq!(x.foo(), format!("hello"));
+
+    // I'm not sure whether we want this to work
+    let x = Box::new(A) as Box<dyn Foo>;
+    assert_eq!(x.foo(), format!("hello"));
 }