-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Miri: move ModifiedStatic to ConstEval errors #70241
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk |
@@ -11,7 +11,7 @@ LL | / const MUTATING_BEHIND_RAW: () = { | |||
LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. | |||
LL | | unsafe { | |||
LL | | *MUTABLE_BEHIND_RAW = 99 | |||
| | ^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc1 which is read-only | |||
| | ^^^^^^^^^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changed because we now check "is it mutating" (and error because we cannot mutate any global memory) before we check "is the target memory read-only".
Maybe I should try getting the original error back...
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…erminology from "static" to "global" where appropriate
@bors r+ |
📌 Commit 7a73b87 has been approved by |
@bors r=oli-obk |
📌 Commit 1939b4c has been approved by |
Miri: move ModifiedStatic to ConstEval errors Also generally adjust terminology from "static" to "global" where appropriate (to avoid confusion with specifically `static` items).
Rollup of 8 pull requests Successful merges: - rust-lang#70023 (clean up E0436 explanation) - rust-lang#70234 (#[track_caller] on core::ops::{Index, IndexMut}.) - rust-lang#70241 (Miri: move ModifiedStatic to ConstEval errors) - rust-lang#70342 (IoSlice/IoSliceMut should be Send and Sync) - rust-lang#70350 (Request "-Z unstable-options" for unstable options) - rust-lang#70355 (Clean up E0454) - rust-lang#70359 (must_use on split_off) - rust-lang#70368 (Mark hotplug_codegen_backend as ignore-stage1) Failed merges: r? @ghost
const STATIC_KIND: Option<!> = None; // no copying of statics allowed | ||
const GLOBAL_KIND: Option<!> = None; // no copying of globals allowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the comment mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, "from tcx
" was the missing part, at a glance this looks like it's talking about let x = STATIC;
which confused me.
_allocation: &Allocation, | ||
alloc_id: AllocId, | ||
allocation: &Allocation, | ||
def_id: Option<DefId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this to static_def_id
? (in a future PR, since this one is in a rollup)
Also generally adjust terminology from "static" to "global" where appropriate (to avoid confusion with specifically
static
items).