Skip to content

const_eval: comptime functions skip const-checker validation (latent, unstable) #504

@SebTardif

Description

@SebTardif

Bug

In the const checker (compiler/rustc_const_eval/src/check_consts/), comptime functions are excluded from certain const-safety checks. This means code inside #[comptime] blocks can perform operations that would be rejected in normal const fn contexts without the const checker catching them.

This is behind the unstable #[comptime] feature gate and appears to be an intentional temporary exclusion during development. However, it should be tracked as it could become a soundness concern if the feature stabilizes without re-enabling the checks.

Impact

Latent, behind unstable feature gate. Not a current soundness issue but could become one if comptime stabilizes without addressing this.

Found in

Round 66, const evaluator deep audit (2026-06-20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalConst evaluationP-lowLow impact: edge case or niche scenariobugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions