summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
AgeCommit message (Collapse)AuthorLines
2022-09-02CTFE: more informative error message on ReadPointerAsBytes troubleRalf Jung-34/+10
2022-08-01Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqdMatthias Krüger-27/+23
Improve size assertions. - For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order. r? `@lqd`
2022-08-01Improve size assertions.Nicholas Nethercote-27/+23
- For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order.
2022-07-30Use LocalDefId for closures moreCameron Steffen-1/+1
2022-07-26Rollup merge of #99692 - RalfJung:too-far, r=oli-obkDylan DPC-24/+48
interpret, ptr_offset_from: refactor and test too-far-apart check We didn't have any tests for the "too far apart" message, and indeed that check mostly relied on the in-bounds check and was otherwise probably not entirely correct... so I rewrote that check, and it is before the in-bounds check so we can test it separately.
2022-07-26Rollup merge of #99673 - RalfJung:interpret-invalid-dyn, r=oli-obkYuki Okushi-2/+2
don't ICE on invalid dyn calls Due to https://github.com/rust-lang/rust/issues/50781 this is actually reachable. Fixes https://github.com/rust-lang/miri/issues/2432 r? ``@oli-obk``
2022-07-24interpret, ptr_offset_from: refactor and test too-far-apart checkRalf Jung-24/+48
2022-07-24don't ICE on invalid dyn callsRalf Jung-2/+2
2022-07-23now we can make scalar_to_ptr a method on ScalarRalf Jung-33/+12
2022-07-23remove some provenance-related machine hooks that Miri no longer needsRalf Jung-46/+17
2022-07-22interpret: fix vtable check debug assertionRalf Jung-2/+1
2022-07-20detect bad vptrs on dyn callsRalf Jung-15/+46
2022-07-20detect bad vtables on an upcastRalf Jung-2/+5
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-12/+12
2022-07-20incorporate some review feedbackRalf Jung-28/+8
2022-07-20add intrinsic to access vtable size and alignRalf Jung-0/+12
2022-07-20make use of symbolic vtables in interpreterRalf Jung-193/+93
2022-07-20rename get_global_alloc to try_get_global_allocRalf Jung-9/+9
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-1/+17
2022-07-20Auto merge of #99472 - RalfJung:provenance, r=oli-obkbors-475/+478
interpret: rename Tag/PointerTag to Prov/Provenance We were pretty inconsistent with calling this the "tag" vs the "provenance" of the pointer; I think we should consistently call it "provenance". r? `@oli-obk`
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-10/+0
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-19interpret: rename Tag/PointerTag to Prov/ProvenanceRalf Jung-475/+478
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.
2022-07-19Auto merge of #99309 - RalfJung:no-large-copies, r=oli-obkbors-78/+50
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`
2022-07-18interpret: make some large types not CopyRalf Jung-35/+41
2022-07-18interpret: remove some unused trait implsRalf Jung-44/+10
2022-07-18Rollup merge of #99378 - RalfJung:box-early-return, r=oli-obkDylan DPC-0/+3
interpret/visitor: add missing early return I forgot to add this when adding the special `Box` handling branch. r? ```@oli-obk```
2022-07-17Auto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obkbors-29/+27
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 :)
2022-07-17interpret/visitor: add missing early returnRalf Jung-0/+3
2022-07-16Rollup merge of #99259 - RalfJung:visit-a-place, r=oli-obkMatthias Krüger-49/+271
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`
2022-07-15interpret/visitor: support visiting with a PlaceTyRalf Jung-47/+267
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-0/+10
2022-07-15Auto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obkbors-21/+12
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.
2022-07-14interpret/validity: improve some commentsRalf Jung-2/+4
2022-07-14Use constant eval to do strict validity checks5225225-29/+27
2022-07-14rename MPlaceTy::dangling to fake_alloc_zstRalf Jung-2/+4
2022-07-14Remove comment referring to constness.rsDaniel Bevenius-2/+0
This commit removes the comment in emulate_intrinsic, which is currently referring to 'src/librustc_middle/ty/constness.rs'.
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-4/+4
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPCbors-2/+2
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
2022-07-13Auto merge of #98145 - ouz-a:some_branch, r=oli-obkbors-0/+5
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`
2022-07-13get rid of MemPlaceMeta::PoisonRalf Jung-20/+9
MPlaceTy::dangling still exists, but now it is only called in places that actually conceptually allocate something new, so that's fine.
2022-07-13Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddybDylan DPC-2/+2
`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
2022-07-12add new rval, pull deref earlyouz-a-0/+5
2022-07-11use a loop rather than try_foldRalf Jung-23/+21
2022-07-11interpret: refactor projection handling codeRalf Jung-421/+531
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.
2022-07-09Auto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obkbors-6/+7
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`
2022-07-09tweak names and output and blessRalf Jung-1/+1
2022-07-09review feedbackRalf Jung-1/+1
2022-07-09don't allow ZST in ScalarIntRalf Jung-6/+7
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.
2022-07-09Rollup merge of #99022 - pierwill:always-storage-live-locals, r=pierwillMatthias Krüger-2/+2
MIR dataflow: Rename function to `always_storage_live_locals` Related to #99021. r? ```@JakobDegen``` (as discussed on Zulip)
2022-07-09Rollup merge of #98980 - RalfJung:const-prop-ice, r=oli-obkDylan DPC-5/+9
fix ICE in ConstProp Fixes https://github.com/rust-lang/rust/issues/96169