Skip to content

Can't import super #29036

Description

@wthrowe

I'm not sure if this falls into the realm of something needing an RFC or not, but I expected this to work:

mod a {
    use super as foo;
}

but it gives error: expected identifier, found keyword super``.

If I do it in an import list I get a different error:

mod a {
    use super::{self as foo};
}

error: unresolved import super. There is no superin???``

(I suppose this also applies to self, but I can't think of a reason to do that.)

Edit: This seems to work as a substitute:

mod a {
    mod foo { pub use super::super::*; }
}

Activity

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

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.T-langRelevant to the language team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions