about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2022-07-20make use of symbolic vtables in interpreterRalf Jung-193/+93
2022-07-20rename get_global_alloc to try_get_global_allocRalf Jung-11/+11
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-1/+17
2022-07-20Auto merge of #99472 - RalfJung:provenance, r=oli-obkbors-478/+481
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-13/+1
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-19interpret: rename Tag/PointerTag to Prov/ProvenanceRalf Jung-478/+481
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-30/+74
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-16Stabilize `let_chains`Caio-1/+1
2022-07-16Rollup merge of #99259 - RalfJung:visit-a-place, r=oli-obkMatthias Krüger-50/+272
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-48/+268
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-1/+13
2022-07-15Auto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obkbors-22/+13
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-30/+74
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-6/+6
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-4/+4
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-1/+23
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-21/+10
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-4/+4
`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-13Auto merge of #99101 - RalfJung:interpret-projections, r=oli-obkbors-432/+540
interpret: refactor projection handling code 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. This is the common part of https://github.com/rust-lang/rust/pull/99013 and https://github.com/rust-lang/rust/pull/99097. I am seeing some strange perf results so this probably should be its own change so we know which diff caused which perf changes... r? `@oli-obk`
2022-07-12add new rval, pull deref earlyouz-a-1/+23
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-11Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-deadDylan DPC-1/+1
Implement `SourceMap::is_span_accessible` This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
2022-07-11rename a methodTakayuki Maeda-1/+1
2022-07-11implement `is_accessible_span`Takayuki Maeda-1/+1
2022-07-11Deny floats even when adt_const_params is enabledMichael Goulet-1/+1
2022-07-09Auto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obkbors-14/+11
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-3/+3
2022-07-09review feedbackRalf Jung-3/+3
2022-07-09don't allow ZST in ScalarIntRalf Jung-14/+11
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 #99050 - JakobDegen:storage-docs, r=tmiaskoMatthias Krüger-1/+7
Clarify MIR semantics of storage statements Seems worthwhile to start closing out some of the less controversial open questions about MIR semantics. Hopefully this is fairly non-controversial - it's what we implement already, and I see no reason to do anything more restrictive. cc ``@tmiasko`` who commented on this when it was discussed in the original PR that added these docs.
2022-07-09Rollup merge of #99022 - pierwill:always-storage-live-locals, r=pierwillMatthias Krüger-4/+4
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-7/+11
fix ICE in ConstProp Fixes https://github.com/rust-lang/rust/issues/96169
2022-07-08Clarify MIR semantics of storage statementsJakob Degen-1/+7
2022-07-08interpret: only to track_caller in debug builds due to perfRalf Jung-4/+4
2022-07-08Migrate MutDeref, TransientMutBorrow diagnosticsMichael Goulet-18/+40
2022-07-08Migrate PanicNonStr, RawPtrComparison, RawPtrToInt diagnosticsMichael Goulet-23/+30
2022-07-08Migrate StaticAccess diagnosticMichael Goulet-19/+21
2022-07-08Migrate NonConstOp diagnosticMichael Goulet-7/+9
2022-07-08Migrate unstable-in-stable diagnosticMichael Goulet-20/+25
2022-07-07MIR dataflow: Rename function to `always_storage_live_locals`pierwill-4/+4
Related to #99021.
2022-07-07Rollup merge of #98979 - RalfJung:more-alloc-range, r=oli-obkMatthias Krüger-2/+2
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``