]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/suggest-deferences/issue-39029.rs
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
[rust.git] / src / test / ui / traits / suggest-deferences / issue-39029.rs
1 // run-rustfix
2 use std::net::TcpListener;
3
4 struct NoToSocketAddrs(String);
5
6 impl std::ops::Deref for NoToSocketAddrs {
7     type Target = String;
8     fn deref(&self) -> &Self::Target {
9         &self.0
10     }
11 }
12
13 fn main() {
14     let _works = TcpListener::bind("some string");
15     let bad = NoToSocketAddrs("bad".to_owned());
16     let _errors = TcpListener::bind(&bad);
17     //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied
18 }