Skip to content

const evaluating && and || does not short-circuit #29608

Closed
@oli-obk

Description

@oli-obk

This prints false

println!("{}", false && ((1u8 - 5u8) == 42));

This gives a compile time error

const X: bool = false && ((1u8 - 5u8) == 42);
println!("{}", X);

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions