mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
19 lines
402 B
Rust
19 lines
402 B
Rust
use std::fmt::Display;
|
|
|
|
fn main() {
|
|
test("hi", true);
|
|
}
|
|
|
|
fn test<T: Display>(t: T, recurse: bool) -> impl Display {
|
|
let f = || {
|
|
let i: u32 = test::<i32>(-1, false);
|
|
//~^ ERROR concrete type differs from previous defining opaque type use
|
|
//~| ERROR expected generic type parameter, found `i32`
|
|
println!("{i}");
|
|
};
|
|
if recurse {
|
|
f();
|
|
}
|
|
t
|
|
}
|