-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.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
trait MyFrom<T> {}
impl<T> MyFrom<T> for T {}
trait MyInto<T> {}
impl<T, U> MyInto<U> for T where U: MyFrom<T> {}
trait A<'self_> {
type T;
}
trait B: for<'self_> A<'self_> {
//type U: for<'self_> MyFrom<<Self as A<'self_>>::T>; // <-- this won't compile
type U: for<'self_> MyInto<<Self as A<'self_>>::T>; // <-- but this will
}
struct M;
impl<'self_> A<'self_> for M {
type T = usize;
}
impl B for M {
type U = usize;
}
fn main() {}
This could've been written with MyInto
written as Into
and similarly for MyFrom
/From
. It was written this way only to make explicit the necessity of one blanket impl for satisfying the other.
I'm guessing that extensional equality is not judged, even though it is possible to make such a judgment and such a judgment must be made to compile code that compiles today. <Self as A<'self_>>::T
on line 12 ought to be equated to usize
(which must be detected at some other point in time else line 13 wouldn't be able to compile).
EDIT: Playing around a bit, it looks more and more like it's all about the HKL bounds...
mikebenfield, demurgos, schneiderfelipe and ahlincschneiderfelipe and ahlinc
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.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.