-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Downgrade const eval dangling ptr in final to future incompat lint #122204
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
Merged
bors
merged 9 commits into
rust-lang:master
from
pnkfelix:downgrade-const-eval-dnagling-ptr-in-final-to-future-incompat-lint
Mar 14, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a8549b4
downgrade mutable-ptr-in-final-value from hard-error to future-incomp…
pnkfelix f86b46a
regression test from 121610.
pnkfelix 1c3424b
Added `deny(const_eval_mutable_ptr_in_final_value)` attribute to all …
pnkfelix 6ca46da
Added an "Explanation" header and expanded that section for the newly…
pnkfelix 354c41e
Updated the test to include more output normalization.
pnkfelix ae374cf
Add produces as tidy requires
wesleywiser 1ea091a
Rebase. Update expected output to match current output.
pnkfelix 9c33cc6
placate tidy.
pnkfelix 8f45a9e
include 32-bit variant for updated test of miri diagnostics.
pnkfelix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.