-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
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. |
@@ -63,7 +63,6 @@ pub trait Machine<'mir, 'tcx>: Sized { | |||
fn mark_static_initialized<'a>( | |||
_mem: &mut Memory<'a, 'mir, 'tcx, Self>, | |||
_id: AllocId, | |||
_mutability: Mutability, |
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 argument needs to stay for miri the tool
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 tool use it for?
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.
Knowing whether the memory can be changed. The tool actually mutates statics.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
NopLogger
instatic mut LOGGER: &'static Log = &NopLogger
will be marked mutable bymark_static_initialized
. With this bugfix,Allocation.runtime_mutability
is entirely unused and is removed.r? @oli-obk