mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +00:00
Add test for issue-27697
This commit is contained in:
parent
9d5b6efdf6
commit
b4c73a297c
21
src/test/ui/issues/issue-27697.rs
Normal file
21
src/test/ui/issues/issue-27697.rs
Normal file
@ -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() {}
|
Loading…
Reference in New Issue
Block a user