Unsafety checks for "unconst" operations do not trigger in unstable functions #72394
Labels
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
A-stability
Area: `#[stable]`, `#[unstable]` etc.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Some operations, such as raw pointer comparisons, require
unsafe
when inside a const context. To my knowledge, none of these operations have been const-stabilized. Accordingly, the following example fails to compile due to a missing unsafe block.However, the check does not run for
const_unstable
functions. The following compiles successfully:This is an easy problem to fix, but the root cause here is poor naming. Specifically,
fn_queries::is_const_fn
should be renamedis_callable_as_const_fn
andis_const_fn_raw
should beis_declared_const_fn
. We have had other issues due to this in the past. cc @rust-lang/wg-const-eval to weigh in on the renaming.The text was updated successfully, but these errors were encountered: