Skip to content

Keywords are not handled as keywords when immediately followed by :: #17298

Closed
@huonw

Description

@huonw
fn main() {
    struct::foo();
    mut::baz();
}
<anon>:2:5: 2:16 error: failed to resolve. Use of undeclared module `struct`
<anon>:2     struct::foo();
             ^~~~~~~~~~~
<anon>:2:5: 2:16 error: unresolved name `struct::foo`.
<anon>:2     struct::foo();
             ^~~~~~~~~~~
<anon>:3:5: 3:13 error: failed to resolve. Use of undeclared module `mut`
<anon>:3     mut::baz();
             ^~~~~~~~
<anon>:3:5: 3:13 error: unresolved name `mut::baz`.
<anon>:3     mut::baz();
             ^~~~~~~~

Due to the falses:

(etc.)

Adding a space, e.g. struct ::foo() causes errors like expected ident, found ::``, while a normal module path can freely have spaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions