Skip to content

Can't cast char to char #12655

Closed
Closed
@veddan

Description

@veddan

All other types can be cast to themselves just fine, but trying to compile

fn main() {
    let a = 'c';
    let b = a as char;
}

gives

bug.rs:3:13: 3:22 error: only `u8` can be cast as `char`, not `char`
bug.rs:3     let b = a as char;
                     ^~~~~~~~~
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions