-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Unsafety checks for "unconst" operations do not trigger in unstable functions #72394
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-stabilityArea: `#[stable]`, `#[unstable]` etc.Area: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Some operations, such as raw pointer comparisons, require
unsafewhen 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_unstablefunctions. The following compiles successfully:This is an easy problem to fix, but the root cause here is poor naming. Specifically,
fn_queries::is_const_fnshould be renamedis_callable_as_const_fnandis_const_fn_rawshould 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.