Skip to content

Constraint information is not propagated #1178

@yongqli

Description

@yongqli

I would expect this code to compile, but it does not:

use std::ops::{Mul};

pub trait M: Sized where f64: Mul<Self, Output=Self> {
}

pub trait M2: M {
    fn f(self, a: f64) -> Self {
        a * self
    }
}

Having to repeat constraints leads to more verbose code and is only repeating information that the compiler already knows.

See previous discussion: rust-lang/rust#26564

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions