-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-inferenceArea: Type inferenceArea: Type inferenceA-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.WG-traits[RETIRED] Working group: Traits[RETIRED] Working group: Traits
Description
I could have sworn I read a similar issue a couple of days/weeks ago but I could not find it back. #37138 seems related too.
Shoudn't this code compile? playground
struct A;
trait Foo<T> {}
impl Foo<i32> for A {}
fn f<T>(_: T) where A: Foo<T> {
g(3i32);
// Works:
// g::<i32>(3);
}
fn g<T>(_: T) where A: Foo<T> {}
fn main() {
f(3);
}
error[E0308]: mismatched types
--> src/main.rs:6:7
|
6 | g(3i32);
| ^^^^ expected type parameter, found i32
|
= note: expected type `T`
found type `i32`
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
A-inferenceArea: Type inferenceArea: Type inferenceA-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.WG-traits[RETIRED] Working group: Traits[RETIRED] Working group: Traits