2023-01-01 23:48:10 +00:00
|
|
|
use std::ops::Add;
|
|
|
|
|
|
|
|
|
|
fn dbl<T>(x: T) -> <T as Add>::Output
|
2025-01-30 04:23:14 +00:00
|
|
|
//~^ ERROR type annotations needed
|
2023-01-01 23:48:10 +00:00
|
|
|
where
|
|
|
|
|
T: Copy + Add,
|
|
|
|
|
UUU: Copy,
|
|
|
|
|
//~^ ERROR cannot find type `UUU` in this scope
|
|
|
|
|
{
|
|
|
|
|
x + x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
println!("{}", dbl(3));
|
|
|
|
|
}
|