Skip to content

Associated types should be permitted in impl headers #18757

Description

@carllerche

Code

#![feature(associated_types)]

pub trait Foo {
    type Bar: Sized;

    fn invoke(&self, bar: <Self as Foo>::Bar);
}

pub struct Wrap<F, B> {
    foo: F,
    bar: B,
}

impl<F: Foo> Wrap<F, <F as Foo>::Bar> {
    // Does not compile  ^^
}

pub fn main() {
}

Output

$ rustc at.rs
at.rs:14:22: 14:37 error: this associated type is not allowed in this context
at.rs:14 impl<F: Foo> Wrap<F, <F as Foo>::Bar> {
                              ^~~~~~~~~~~~~~~
error: aborting due to previous error

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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