Skip to content

Commit 4fd895a

Browse files
committed
Add autoderef tests for by-value trait objects.
1 parent b3dce87 commit 4fd895a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/test/run-pass/unsized-locals/by-value-trait-object-safety-withdefault.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ impl Foo for A {}
2424
fn main() {
2525
let x = *(Box::new(A) as Box<dyn Foo>);
2626
assert_eq!(x.foo(), format!("hello"));
27+
28+
// I'm not sure whether we want this to work
29+
let x = Box::new(A) as Box<dyn Foo>;
30+
assert_eq!(x.foo(), format!("hello"));
2731
}

src/test/run-pass/unsized-locals/by-value-trait-object-safety.rs

+4
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ impl Foo for A {
2626
fn main() {
2727
let x = *(Box::new(A) as Box<dyn Foo>);
2828
assert_eq!(x.foo(), format!("hello"));
29+
30+
// I'm not sure whether we want this to work
31+
let x = Box::new(A) as Box<dyn Foo>;
32+
assert_eq!(x.foo(), format!("hello"));
2933
}

0 commit comments

Comments
 (0)