mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
19 lines
447 B
Rust
19 lines
447 B
Rust
// 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
|
|
}
|