Skip to content

Commit

Permalink
Rollup merge of rust-lang#62016 - JohnTitor:add-test-for-issue-27697,…
Browse files Browse the repository at this point in the history
… r=alexcrichton

Add test for issue-27697

Closes rust-lang#27697
  • Loading branch information
Centril authored Jun 21, 2019
2 parents 912ab3a + b4c73a2 commit 46948c6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/ui/issues/issue-27697.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// run-pass

use std::ops::Deref;

trait MyTrait {
fn do_something(&self);
fn as_str(&self) -> &str;
}

impl Deref for dyn MyTrait {
type Target = str;
fn deref(&self) -> &Self::Target {
self.as_str()
}
}

fn trait_object_does_something(t: &dyn MyTrait) {
t.do_something()
}

fn main() {}

0 comments on commit 46948c6

Please sign in to comment.