Skip to content

ICE with const as statement #29637

Closed
Closed
@nrc

Description

@nrc
const FOO: i32 = 42;
fn main() {
    FOO;
}
<anon>:3:5: 3:9 warning: path statement with no effect, #[warn(path_statements)] on by default
<anon>:3     FOO;
             ^~~~
<anon>:3:5: 3:8 error: internal compiler error: constant expression should not reach expr::trans_def
<anon>:3     FOO;
             ^~~

Note that this is fixed by changing to let _ = FOO;.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions