Skip to content

Commit

Permalink
Add autoderef tests for by-value trait objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
qnighy committed Oct 24, 2018
1 parent b3dce87 commit 4fd895a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,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"));
}

0 comments on commit 4fd895a

Please sign in to comment.