summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-27697.rs
blob: 12af8a8e875af20e4e3690d846054d046d15124e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// check-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() {}