Skip to content

Commit

Permalink
regression test from 121610.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Mar 13, 2024
1 parent a8549b4 commit f86b46a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//@ check-pass
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;
//~^ WARN encountered mutable pointer in final value of constant
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

fn main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
warning: encountered mutable pointer in final value of constant
--> $DIR/future-incompat-mutable-in-final-value-issue-121610.rs:13:1
|
LL | const UNDEFINED: &JsValue = &JsValue::Undefined;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
= note: `#[warn(const_eval_mutable_ptr_in_final_value)]` on by default

warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: encountered mutable pointer in final value of constant
--> $DIR/future-incompat-mutable-in-final-value-issue-121610.rs:13:1
|
LL | const UNDEFINED: &JsValue = &JsValue::Undefined;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
= note: `#[warn(const_eval_mutable_ptr_in_final_value)]` on by default

0 comments on commit f86b46a

Please sign in to comment.