Skip to content

constants are not constant due to ptr->int casts #18294

Closed
@thestinger

Description

@thestinger
fn main() {
    const X: u32 = 1;
    const Y: uint = &X as *const u32 as uint;
    println!("{}", Y);
}

Fixing this requires backwards incompatible changes to constant expressions. At a minimum, casts from pointers to integers need to be forbidden. It's possible that there are other issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions