Skip to content

Can't import super #29036

Open
Open
@wthrowe

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::*; }
}

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, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions