Skip to content

Associated Types Regression #19059

Closed
Closed
@dylanmckay

Description

@dylanmckay

When implementing a trait with more than one associated type, the compiler complains:

note: the trait `Device` must be implemented because it is required by `Device`

This problem is fairly recent; the code used to compile several weeks ago on Rust master.

The problem does not occur when the trait Device has only one associated type. Note that the error occurs on the same line as the trait implementation.

Also on the Playpen

#![feature(associated_types)]

// using one associated type compiles fine
// using two causes an error

// a trait using associated types
pub trait Device
{
    type Program;

    // error: ###comment this next line out ###
    type Viewport;
}

// a struct which implemented the trait
pub struct TestDevice(u32);

impl Device for TestDevice
{
    type Program = u32;

    // error: ###comment this next line out ###
    type Viewport = i64;
}

fn main() { }

This issue is linked with #19058, which is caused by the same snippet of code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions