Closed
Description
Given the following code:
pub trait Foo { type T; }
impl Foo for i32 { type T = f32; }
pub struct U<T1, T2>(T1, S<T2>) where T1: Foo<T = T2>;
pub struct S<T>(T);
fn a() {
let _: U<_, u32> = U(1, S(3u32));
}
The current output is:
error[E0308]: mismatched types
--> src/lib.rs:9:29
|
9 | let _: U<_, u32> = U(1, S(3u32));
| - ^^^^^^^ expected `f32`, found `u32`
| |
| arguments to this struct are incorrect
|
= note: expected struct `S<_>` (`f32`)
found struct `S<_>` (`u32`)
note: tuple struct defined here
--> src/lib.rs:4:12
|
4 | pub struct U<T1, T2>(T1, S<T2>) where T1: Foo<T = T2>;
| ^
help: consider removing the ``
|
9 | let _: U<_, u32> = U(1, S(3u32));
|
error[E0308]: mismatched types
--> src/lib.rs:9:24
|
9 | let _: U<_, u32> = U(1, S(3u32));
| --------- ^^^^^^^^^^^^^ expected `u32`, found `f32`
| |
| expected due to this
|
= note: expected struct `U<_, u32>`
found struct `U<i32, f32>`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground` due to 2 previous errors