Skip to content

Weird error message for non-const const fns #59611

Closed

Description

@brson
const fn foo() { panic!() }

fn main() { }
   Compiling playground v0.0.1 (/playground)
error: can only call other `min_const_fn` within a `min_const_fn`
 --> src/main.rs:1:18
  |
1 | const fn foo() { panic!() }
  |                  ^^^^^^^^
  |
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

The name min_const_fn seems meaningless to an end user. It should say something like "only call const functions within const functions."

Activity

  1. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Apr 1, 2019
  2. added a commit that references this issue on Apr 17, 2019
    0349b78
  3. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Dec 1, 2024
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, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.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