Skip to content

error: Trait not implemented for type... on the line of the implementation for the type #18809

@soltanmm

Description

@soltanmm

This was the smallest I could make it. Commenting out the lines for either T0 or T1 or making T0 and T1 the same type allows compilation to finish successfully.

#![feature(associated_types)]
trait Tup {
    type T0;
    type T1;
}
impl Tup for int {
    type T0 = f32;
    type T1 = ();
}
fn main() {
}

Error:

a.rs:6:1: 9:2 error: the trait `Tup` is not implemented for the type `int`
a.rs:6 impl Tup for int {
a.rs:7     type T0 = f32;
a.rs:8     type T1 = ();
a.rs:9 }
a.rs:6:1: 9:2 note: the trait `Tup` must be implemented because it is required by `Tup`
a.rs:6 impl Tup for int {
a.rs:7     type T0 = f32;
a.rs:8     type T1 = ();
a.rs:9 }
error: aborting due to previous error

What I don't understand is: why in the world is it even complaining about Tup implementations when no one is using Tup? Is this some sort of weird interaction with trait object types?

(rustc at commit a2f303a, Linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions