-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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