Skip to content

Associated Types Regression #19058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dylanmckay opened this issue Nov 18, 2014 · 1 comment
Closed

Associated Types Regression #19058

dylanmckay opened this issue Nov 18, 2014 · 1 comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system

Comments

@dylanmckay
Copy link
Contributor

When compiling this snippet of code, the compiler churns out the most nonsensical error:

error: the trait `Device` is not implemented for the type `TestDevice`
...
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
Note: Changing the Rust version to 0.12.0 on the Playpen causes a successful compilation.

#![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 #19059 , which is caused by the same snippet of code.

@sfackler sfackler added the A-trait-system Area: Trait system label Nov 18, 2014
@huonw huonw added the A-associated-items Area: Associated items (types, constants & functions) label Nov 20, 2014
@dylanmckay
Copy link
Contributor Author

My linked snippet of code now compiles successfully. Closing as the issue no longer persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system
Projects
None yet
Development

No branches or pull requests

3 participants