Remove Allocation.runtime_mutability#50193
Conversation
|
Won't this break We also need the flag for #49933 though it might be possible to get that flag back via the machine. |
| fn mark_static_initialized<'a>( | ||
| _mem: &mut Memory<'a, 'mir, 'tcx, Self>, | ||
| _id: AllocId, | ||
| _mutability: Mutability, |
There was a problem hiding this comment.
This argument needs to stay for miri the tool
There was a problem hiding this comment.
What does the tool use it for?
There was a problem hiding this comment.
Knowing whether the memory can be changed. The tool actually mutates statics.
There was a problem hiding this comment.
The tool shouldn't use mark_static_initialized at all though, since that only applies to compile time execution?
There was a problem hiding this comment.
we need to do this because otherwise we deallocate the memory of the 42 in static FOO: &u32 = &42; after the computation is done.
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
That is illegal. Edit: but |
|
Immutable references to unsafecell also need to be marked I think |
Those give: |
|
Isn't that just a limitation of the current system? static mut FOO: &UnsafeCell<i32> = &UnsafeCell::new(42);should be fine in my mental model of statics |
|
@oli-obk Those should be allowed, yes, but only for "escaping" references (i.e. no |
This fixes a bug where
NopLoggerinstatic mut LOGGER: &'static Log = &NopLoggerwill be marked mutable bymark_static_initialized. With this bugfix,Allocation.runtime_mutabilityis entirely unused and is removed.r? @oli-obk