Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unconstrained inference variables in generic impl block #3242

Open
philberty opened this issue Nov 6, 2024 · 0 comments
Open

Unconstrained inference variables in generic impl block #3242

philberty opened this issue Nov 6, 2024 · 0 comments

Comments

@philberty
Copy link
Member

philberty commented Nov 6, 2024

Summary

There is an issue with this test case it was issue-1773.rs but that issue references different code.

Reproducer

I tried this code:

#[lang = "sized"]
pub trait Sized {}

trait Foo<T> {
    type A;

    fn test(a: Self::A) -> Self::A {
        a
    }
}

struct Bar<T>(T);
impl<T> Foo<T> for Bar<i32> {
    type A = T;
}

fn main() {
    let a;
    a = Bar(123);

    let b;
    b = Bar::test(a.0);
}

Godbolt link

No response

Actual behavior

The current behavior is...

test.rs:21:9: error: type annotations needed [E0282]
   21 |     let b;
      |         ^
test.rs:22:5: error: type annotations needed [E0282]
   22 |     b = Bar::test(a.0);
      |     ^
test.rs:22:14: error: type annotations needed [E0282]
   22 |     b = Bar::test(a.0);
      |              ^~~~
crab1: error: type annotations needed [E0282]
test.rs:22:14: error: type annotations needed [E0282]
crab1: error: type annotations needed [E0282]
crab1: error: type annotations needed [E0282]

Expected behavior

I expected to see...

compiles without error

GCC Version

0e6135c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant