Skip to content

const fn allows unreachable calls to non-const fns #62404

Description

@Centril

E.g. the following compiles on stable:

const fn f() {
    return;
    fn f() {}
    f();
}

@eddyb notes that this is because we do a "semantic check" and that f(); is not linked in the CFG.

However, it seems to me that the basic blocks should be there (tho I haven't checked yet...) so you can visit the call to f(); and ban it.

cc @oli-obk

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions