Skip to content

Failed to find impl for trait, but that trait shouldn't be used anyway #12145

Closed
@DaGenix

Description

@DaGenix

The following code fails to compile:

pub trait Even {
    fn say(&self);
}

impl <'a, E: Even> Even for &'a mut E {
    fn say(&self) { }
}

pub trait Odd {
    fn say(&self);
}

fn print_odd<O: Odd>(o: &mut O) {
    o.say();
}

fn main() { }

with the error:

foo9.rs:14:5: 14:12 error: failed to find an implementation of trait Even for O
foo9.rs:14     o.say();
               ^~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions