forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#122204 - pnkfelix:downgrade-const-eval-dnagli…
…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.
- Loading branch information
Showing
16 changed files
with
876 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
#![feature(core_intrinsics)] | ||
#![feature(const_heap)] | ||
#![feature(const_mut_refs)] | ||
#![deny(const_eval_mutable_ptr_in_final_value)] | ||
use std::intrinsics; | ||
|
||
const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32 }; | ||
//~^ error: mutable pointer in final value of constant | ||
//~| WARNING this was previously accepted by the compiler | ||
|
||
fn main() {} |
25 changes: 24 additions & 1 deletion
25
tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
error: encountered mutable pointer in final value of constant | ||
--> $DIR/alloc_intrinsic_untyped.rs:6:1 | ||
--> $DIR/alloc_intrinsic_untyped.rs:7:1 | ||
| | ||
LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32 }; | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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: the lint level is defined here | ||
--> $DIR/alloc_intrinsic_untyped.rs:4:9 | ||
| | ||
LL | #![deny(const_eval_mutable_ptr_in_final_value)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
Future incompatibility report: Future breakage diagnostic: | ||
error: encountered mutable pointer in final value of constant | ||
--> $DIR/alloc_intrinsic_untyped.rs:7:1 | ||
| | ||
LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32 }; | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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: the lint level is defined here | ||
--> $DIR/alloc_intrinsic_untyped.rs:4:9 | ||
| | ||
LL | #![deny(const_eval_mutable_ptr_in_final_value)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
18 changes: 18 additions & 0 deletions
18
tests/ui/consts/future-incompat-mutable-in-final-value-issue-121610.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/ui/consts/future-incompat-mutable-in-final-value-issue-121610.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.