Skip to content

Cannot have the same supertrait twice, but with different type parameters #10596

Closed
@burtonageo

Description

@burtonageo

I am writing a Euclidean Vector class, and want to override some operations for it. However, when I try to add mul for both Vector-Vector multiplication and Vector-Scalar multiplication, the compiler complains that there is a Duplicate supertrait in trait declaration:

euclidean_vector.rs:5:0: 20:1 error: Duplicate supertrait in trait declaration
euclidean_vector.rs:5 pub trait EuclideanVector<T: Num + Algebraic> : 
euclidean_vector.rs:6   Add<Self, Self> +
euclidean_vector.rs:7   Sub<Self, Self> +
euclidean_vector.rs:8   Mul<Self, Self> +
euclidean_vector.rs:9   Mul<T, Self> +
euclidean_vector.rs:10   One + Zero +

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions