-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
struct Foo<T = u32, U = i32>(T, U);
impl<T, U> Foo<T, U> {
fn foo() -> Self {
loop {}
}
}
fn main() {
let a = Foo::<u32, i32>::foo();
let b = Foo::<u32>::foo(); // ok
let c = Foo::<>::foo(); // ambiguity error
let d = Foo::foo(); // ambiguity error
}
The same way Foo::<u32>
instantiates U
with i32
, so should Foo::<>
for T
and U
.
My expected behavior is that d
is ambiguous while c
compiles
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.