mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
17 lines
234 B
Rust
17 lines
234 B
Rust
use std::fmt::Display;
|
|
|
|
trait Foo {
|
|
fn bar(&self) -> impl Display;
|
|
}
|
|
|
|
impl Foo for () {
|
|
fn bar(&self) -> impl Display {
|
|
"Hello, world"
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let x: &str = ().bar();
|
|
//~^ ERROR mismatched types
|
|
}
|