-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)A-trait-systemArea: Trait systemArea: Trait 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-langRelevant to the language teamRelevant to the language team
Description
I might be missing something but I believe the following (playpen) should compile but does not:
use std::ops::Mul;
fn main() {
}
trait Ring { }
trait Real: Ring { }
trait Module: Sized + Mul<<Self as Module>::Ring, Output = Self> {
type Ring: Ring;
}
trait EuclideanSpace {
type Coordinates: Module<Ring = Self::Real>;
type Real: Real;
}
pub trait Translation<E: EuclideanSpace> {
fn to_vector(&self) -> E::Coordinates;
fn powf(&self, n: <E::Coordinates as Module>::Ring) -> E::Coordinates {
self.to_vector() * n
}
}
In self.to_vector() * n
, the compiler seems to understand that <E::Coordinates as Module>::Ring>
is the same thing as E::Real
but fails to applies the Mul<<Self as Module>::Ring, Output = Self>
trait from Module
.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)A-trait-systemArea: Trait systemArea: Trait 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-langRelevant to the language teamRelevant to the language team
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Release v0.4.0 + added changelog.
Twey commentedon Mar 16, 2017
Smaller test case (Playground):
This code (in the body of
test
) knows thatA::Wibble: Bar
and that<A::Wibble as Bar>::Quux = ()
, but not thatA::Wibble: Foo<()>
.estebank commentedon Nov 5, 2019
Current output:
estebank commentedon Feb 2, 2021
This now compiles.
7 remaining items