Skip to content

Implementation cannot be defined for 'type' alias #13551

@araujol

Description

@araujol

Code example:

Save this in main.rs and try to compile.

enum T {}
type New = T;

impl New {}

fn main() {}

Trying to compile, it shows this error:

impl.rs:4:1: 4:12 error: cannot associate methods with a type outside the crate the type is defined in; define and implement a trait or new type instead
impl.rs:4 impl New {}
^~~~~~~~~~~
error: aborting due to previous error

Using git master HEAD: 6fcf43e

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions