Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird error message for non-const const fns #59611

Closed
brson opened this issue Apr 1, 2019 · 0 comments · Fixed by #59646
Closed

Weird error message for non-const const fns #59611

brson opened this issue Apr 1, 2019 · 0 comments · Fixed by #59646
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@brson
Copy link
Contributor

brson commented Apr 1, 2019

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."

@jonas-schievink jonas-schievink added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-fn labels Apr 1, 2019
Centril added a commit to Centril/rust that referenced this issue Apr 17, 2019
const fn: Improve wording

fixes rust-lang#59611

This might need discussion. Feel free to close this PR if we don't need to fix.
@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants