Skip to content

resolve: nonsensical diagnostics for an expression that resolves to a module #33186

@jseyfried

Description

@jseyfried

This code:

mod foo {}

fn main() {
    let v = Vec::new();
    v.push(foo);
}

produces these diagnostics:

<anon>:5:12: 5:15 error: unresolved name `foo` [E0425]
<anon>:5     v.push(foo);
                    ^~~
<anon>:5:12: 5:15 help: see the detailed explanation for E0425
<anon>:5:12: 5:15 help: To call a function from the `foo` module, use `foo::push(..)`

The suggestion doesn't make sense -- we should instead emit something like "modules are not valid expressions".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions