Conversation
|
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
| abi::Abi::Rust => return Err(( | ||
| span, | ||
| "can only call other `min_const_fn` within a `min_const_fn`".into(), | ||
| "can only call other `const` within a `const`".into(), |
There was a problem hiding this comment.
Something like can only call another `const fn` within a `const` block sounds more natural.
There was a problem hiding this comment.
Neither this PR nor the suggestion is accurate. This is not a const block (and with rust-lang/rfcs#2632 it will not always behave in a similar fashion).
Moreover, I think we lose out on the difference between stable const fns and unstable ones. This is the main point of min_const_fns... I think we should check whether the current compiler can use unstable features and tweak the message based on that. E.g. a stable compiler can just talk about const fns but the nightly compiler should emphasize the difference between stable and unstable ones.
There was a problem hiding this comment.
Maybe change it to
can only call other stable `const fn` within a stable `const fn`
?
There was a problem hiding this comment.
Ah, in that case we should make the error more explicit and add a note to the unstable const fn pointing out that it is undertake.
There was a problem hiding this comment.
That is, it's not clear whether it's the containing function or the called function that is the problem (or both).
There was a problem hiding this comment.
The problem is to be used same wording without distinction, I think. Should we try to work on this?
There was a problem hiding this comment.
kinda both. I'm not sure how easy it is to point to the unstable const fn, since it might be in another crate. We can just use a more verbose wording like
can only call other
const fnwithin aconst fn, butinsert_fn_name_hereis not stable asconst fn
|
r? @oli-obk |
|
ping from triage @oli-obk any updates? |
|
@bors r+ rollup |
|
📌 Commit 4075415 has been approved by |
|
⌛ Testing commit 4075415 with merge 7f83a069569be0fbed78b108abecc2894bfa63d1... |
|
💔 Test failed - checks-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@bors retry |
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.
Rollup of 5 pull requests Successful merges: - #59128 (Emit ansi color codes in the `rendered` field of json diagnostics) - #59646 (const fn: Improve wording) - #59986 (Miri: refactor new allocation tagging) - #60003 (LLD is not supported on Darwin) - #60018 (Miri now supports entropy, but is still slow) Failed merges: r? @ghost
fixes #59611
This might need discussion. Feel free to close this PR if we don't need to fix.