rust/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs

17 lines
234 B
Rust
Raw Normal View History

2022-08-30 23:46:54 -05:00
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
}