summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/suggest-dereferences/issue-39029.fixed
blob: a1abf668b8b6ec8c0e0f08c99dd29f3d09ae88fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-rustfix
use std::net::TcpListener;

struct NoToSocketAddrs(String);

impl std::ops::Deref for NoToSocketAddrs {
    type Target = String;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

fn main() {
    let _works = TcpListener::bind("some string");
    let bad = NoToSocketAddrs("bad".to_owned());
    let _errors = TcpListener::bind(&*bad);
    //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied
}