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

Miri: move ModifiedStatic to ConstEval errors #70241

Merged
merged 6 commits into from
Mar 24, 2020

Conversation

RalfJung
Copy link
Member

Also generally adjust terminology from "static" to "global" where appropriate (to avoid confusion with specifically static items).

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 21, 2020
@RalfJung
Copy link
Member Author

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned estebank Mar 21, 2020
@@ -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
Copy link
Member Author

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...

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@RalfJung

This comment has been minimized.

@bors

This comment has been minimized.

@bors

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 24, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Mar 24, 2020

📌 Commit 7a73b87 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 24, 2020
@RalfJung
Copy link
Member Author

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Mar 24, 2020

📌 Commit 1939b4c has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Mar 24, 2020
Miri: move ModifiedStatic to ConstEval errors

Also generally adjust terminology from "static" to "global" where appropriate (to avoid confusion with specifically `static` items).
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 24, 2020
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
Comment on lines -180 to +181
const STATIC_KIND: Option<!> = None; // no copying of statics allowed
const GLOBAL_KIND: Option<!> = None; // no copying of globals allowed
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See here.

Copy link
Member

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>,
Copy link
Member

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)

@bors bors merged commit b8093ba into rust-lang:master Mar 24, 2020
@RalfJung RalfJung deleted the global-mem branch March 25, 2020 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants