-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`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.
Description
I think I found a bug with associated type bounds! #52662
#![feature(associated_type_bounds)]
trait Foo {
type Bar;
}
fn works<F: Foo>() where F::Bar: Copy {}
// This should be fine, but I get `error[E0221]` instead
fn breaks<F: Foo<Bar: Foo>>() where F::Bar: Copy {}
This is the exact same error you get when you do this
trait Foo<T> {
type Bar;
}
fn breaks<F: Foo<String> + Foo<u32>>() where F::Bar: Copy {}
Because Rust can't tell which Foo::<_>::Bar
you mean, but in the case of associated_type_bounds
, there is no ambiguity, which makes this error confusing.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.F-associated_type_bounds`#![feature(associated_type_bounds)]``#![feature(associated_type_bounds)]`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.