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

Tracking Issue for CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE #122153

Open
pnkfelix opened this issue Mar 7, 2024 · 0 comments
Open

Tracking Issue for CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE #122153

pnkfelix opened this issue Mar 7, 2024 · 0 comments
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-future-compatibility Category: Future-compatibility lints C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Mar 7, 2024

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

@pnkfelix pnkfelix added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. C-future-compatibility Category: Future-compatibility lints T-lang Relevant to the language team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-eval Area: constant evaluation (mir interpretation) labels Mar 7, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 14, 2024
…ng-ptr-in-final-to-future-incompat-lint, r=wesleywiser

Downgrade const eval dangling ptr in final to future incompat lint

Short term band-aid for issue rust-lang#121610, downgrading the prior hard error to a future-incompat lint (tracked in issue rust-lang#122153).

Note we should not mark rust-lang#121610 as resolved until after this (or something analogous) is beta backported.
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 (mir interpretation) C-future-compatibility Category: Future-compatibility lints C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant