Skip to content

Tracking issue for future-incompatibility lint const_eval_mutable_ptr_in_final_value #122153

Closed

Description

@pnkfelix

This is a tracking issue for the CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE lint, which is being added in #122204. The lint detects cases where a const expression evaluates to a value that holds a pointer to mutable state, which is undefined behavior and may be rejected by a future version of the compiler.

Example

This lint will trigger for code like this:

use std::cell::Cell;

pub enum JsValue {
    Undefined,
    Object(Cell<bool>),
}

impl ::std::ops::Drop for JsValue {
    fn drop(&mut self) {}
}

const UNDEFINED: &JsValue = &JsValue::Undefined;

fn main() {
}

Cc #121610

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    T-langRelevant to the language team
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Mar 7, 2024
  2. added a commit that references this issue on Mar 14, 2024
  3. changed the title [-]Tracking Issue for CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE[/-] [+]Tracking issue for future-incompatibility lint `const_eval_mutable_ptr_in_final_value`[/+] on Sep 14, 2024
  4. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    on Sep 14, 2024
  5. added a commit that references this issue on Sep 14, 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-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-future-incompatibilityCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions