Rust-GCC / gccrs

GCC Front-End for Rust
https://rust-gcc.github.io/
GNU General Public License v2.0
2.45k stars 157 forks source link

Type inference on generic type field access #2323

Closed powerboat9 closed 2 weeks ago

powerboat9 commented 1 year ago

I tried this code:

pub struct S<T>(T);

pub fn foo<T>(x: T) {
    let y = S(x);
    y.0;
}

I expected to see this happen: no error

Instead, this happened:

test.rs:5:5: error: type annotations needed

Meta

philberty commented 1 year ago

I have a feeling this is going to get fixed with my work on #2330 as the issue is we are injecting too many inference variables in coercion sites at the moment.

philberty commented 1 year ago

This is a bug in our block expression handling hmm there is another issue which has the same problem.

philberty commented 2 weeks ago

no found the issue finally it was much simpler than i thought