Skip to content

Invalid error (E0425) reported #27433

Closed
Closed
@GuillaumeGomez

Description

@GuillaumeGomez

In the following code:

fn main() {
    let foo = 42u32;
    const FOO : u32 = foo;
}

We have the following errors:

<anon>:3:23: 3:26 error: attempt to use a non-constant value in a constant [E0435]
<anon>:3     const FOO : u32 = foo;
                               ^~~
<anon>:3:23: 3:26 error: unresolved name `foo` [E0425]
<anon>:3     const FOO : u32 = foo;

The first one is "normal", however, the E0425 might mislead developer's understanding on this error.

cc @eddyb

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions