Ensuring that MIR constants are marked as static consts #4233
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.
This is an attempt to resolve #3905
Currently, we rely on the
mutability
of theAllocation
when marking constants. However, my understanding is that for various internal reasons the compiler may use mutable allocations even for constants. Instead, we should probably track whether a variable is constant ourselves.Currently, some tests are failing. Specifically,
tests/expected/function-contract/valid_ptr.rs
fails because, while checkingpre_condition::harness_invalid_ptr
, the output doesn't includeInstead, the assertion is
UNREACHABLE
, which honestly makes perfect sense to me (since the precondition doesn't hold for any input, we'll never get a chance to actually verify this assertion).tests/kani-fixme/FunctionContracts/modify_slice_elem_fixme.rs
also fails, which hopefully indicates that this also resolves #4029 (though the relation between the issue and the PR is not obvious to me).By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.