Skip to content

Z unleash-the-miri-inside-of-you doesnt skip const fn checks while constant evaluating #149912

@HomelikeBrick42

Description

@HomelikeBrick42

I tried this code with the -Zunleash-the-miri-inside-of-you flag:

const FOO: i32 = foo();

fn foo() -> i32 {
    5
}

This should work if i understand the flag correctly and make FOO have the value 5, but instead it gives me an evaluation error

error[E0080]: calling non-const function `foo`
 --> src\lib.rs:3:18
  |
3 | const FOO: i32 = foo();
  |                  ^^^^^ evaluation of `FOO` failed here

warning: skipping const checks
  |
help: skipping check that does not even have a feature gate
 --> src\lib.rs:3:18
  |
3 | const FOO: i32 = foo();
  |                  ^^^^^

For more information about this error, try `rustc --explain E0080`.

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (f52090008 2025-12-10)
binary: rustc
commit-hash: f5209000832c9d3bc29c91f4daef4ca9f28dc797
commit-date: 2025-12-10
host: x86_64-pc-windows-msvc
release: 1.94.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions