| Age | Commit message (Collapse) | Author | Lines |
|
Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere.
In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.
|
|
interpret: make some large types not Copy
Also remove some unused trait impls (mostly HashStable).
This didn't find any unnecessary copies that I managed to avoid, but it might still be better to require explicit clone for these types? Not sure.
r? `@oli-obk`
|
|
|
|
|
|
interpret/visitor: add missing early return
I forgot to add this when adding the special `Box` handling branch.
r? ```@oli-obk```
|
|
Use constant eval to do strict mem::uninit/zeroed validity checks
I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case.
Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies.
I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally.
Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay?
Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested.
Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)
|
|
|
|
interpret/visitor: support visiting with a PlaceTy
Finally we can visit a `PlaceTy` in a way that will only do `force_allocation` when needed ti visit a field. :)
r? `@oli-obk`
|
|
|
|
|
|
interpret: get rid of MemPlaceMeta::Poison
This is achieved by refactoring the projection code (`{mplace,place,operand}_{downcast,field,index,...}`) so that we no longer need to call `assert_mem_place` in the operand handling.
|
|
|
|
|
|
|
|
This commit removes the comment in emulate_intrinsic, which is
currently referring to 'src/librustc_middle/ty/constness.rs'.
|
|
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
|
|
Rollup of 5 pull requests
Successful merges:
- #98574 (Lower let-else in MIR)
- #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside)
- #99030 (diagnostics: error messages when struct literals fail to parse)
- #99155 (Keep unstable target features for asm feature checking)
- #99199 (Refactor: remove an unnecessary `span_to_snippet`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Pull Derefer before ElaborateDrops
_Follow up work to #97025 #96549 #96116 #95887 #95649_
This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`.
r? `@oli-obk`
|
|
MPlaceTy::dangling still exists, but now it is only called in places that
actually conceptually allocate something new, so that's fine.
|
|
`UnsafeCell` blocks niches inside its nested type from being available outside
fixes #87341
This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646
Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527
|
|
|
|
|
|
Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.
mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.
|
|
don't allow ZST in ScalarInt
There are several indications that we should not ZST as a ScalarInt:
- We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it.
`ValTree::zst()` used the former, but the latter could possibly arise as well.
- Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`.
- LLVM codegen already had to special-case ZST ScalarInt.
So I propose we stop using ScalarInt to represent ZST (which are clearly not integers). Instead, we can add new ZST variants to those types that did not have other variants which could be used for this purpose.
Based on https://github.com/rust-lang/rust/pull/98831. Only the commits starting from "don't allow ZST in ScalarInt" are new.
r? `@oli-obk`
|
|
|
|
|
|
There are several indications that we should not ZST as a ScalarInt:
- We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it.
`ValTree::zst()` used the former, but the latter could possibly arise as well.
- Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`.
- LLVM codegen already had to special-case ZST ScalarInt.
So instead add new ZST variants to those types that did not have other variants
which could be used for this purpose.
|
|
MIR dataflow: Rename function to `always_storage_live_locals`
Related to #99021.
r? ```@JakobDegen``` (as discussed on Zulip)
|
|
fix ICE in ConstProp
Fixes https://github.com/rust-lang/rust/issues/96169
|
|
|
|
Related to #99021.
|
|
interpret: use AllocRange in UninitByteAccess
also use nice new format string syntax in `interpret/error.rs`, and use the `#` flag to add `0x` prefixes where applicable.
r? ``@oli-obk``
|
|
|
|
|
|
|
|
|
|
Operand::Uninit is an *allocated* operand that is fully uninitialized.
This lets us lazily allocate the actual backing store of *all* locals (no matter their ABI).
I also reordered things in pop_stack_frame at the same time.
I should probably have made that a separate commit...
|
|
|
|
|
|
also use nice new format string syntax in interpret/error.rs
|
|
assert Scalar sanity
With https://github.com/rust-lang/rust/pull/96814 having landed, finally our `Scalar` layouts have the invariants they deserve. :)
|
|
fix typo in function name
I don't know what I was doing when I named that function...
follow-up to #98888
r? `@oli-obk`
|
|
Split TypeVisitable from TypeFoldable
Impl of rust-lang/compiler-team#520 following MCP approval.
r? `@ghost`
|
|
|
|
|
|
|
|
|
|
interpret: fix CheckedBinOp behavior when overflow checking is disabled
Adjusts the interpreter to https://github.com/rust-lang/rust/pull/98738.
r? `@oli-obk`
|
|
adjust dangling-int-ptr error message
based on suggestions by `@saethlin` in https://github.com/rust-lang/miri/issues/2163
Fixes https://github.com/rust-lang/miri/issues/2163
I also did a bit of refactoring on this, so we have a helper method to create a `Pointer` with `None` provenance.
|
|
|