Skip to content

Commit 46948c6

Browse files
authored
Rollup merge of rust-lang#62016 - JohnTitor:add-test-for-issue-27697, r=alexcrichton
Add test for issue-27697 Closes rust-lang#27697
2 parents 912ab3a + b4c73a2 commit 46948c6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/ui/issues/issue-27697.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// run-pass
2+
3+
use std::ops::Deref;
4+
5+
trait MyTrait {
6+
fn do_something(&self);
7+
fn as_str(&self) -> &str;
8+
}
9+
10+
impl Deref for dyn MyTrait {
11+
type Target = str;
12+
fn deref(&self) -> &Self::Target {
13+
self.as_str()
14+
}
15+
}
16+
17+
fn trait_object_does_something(t: &dyn MyTrait) {
18+
t.do_something()
19+
}
20+
21+
fn main() {}

0 commit comments

Comments
 (0)