about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
AgeCommit message (Collapse)AuthorLines
2022-08-29Rollup merge of #100239 - RalfJung:const-prop-uninit, r=oli-obkDylan DPC-25/+9
remove an ineffective check in const_prop Based on https://github.com/rust-lang/rust/pull/100043, only the last two commits are new. ConstProp has a special check when reading from a local that prevents reading uninit locals. However, if that local flows into `force_allocation`, then no check fires and evaluation proceeds. So this check is not really effective at preventing accesses to uninit locals. With https://github.com/rust-lang/rust/pull/100043, `read_immediate` and friends always fail when reading uninit locals, so I don't see why ConstProp would need a separate check. Thus I propose we remove it. This is needed to be able to do https://github.com/rust-lang/rust/pull/100085.
2022-08-29Rollup merge of #100897 - RalfJung:const-not-to-mutable, r=lcnrMatthias Krüger-27/+45
extra sanity check against consts pointing to mutable memory This should be both unreachable and redundant (since we already ensure that validation only reads from read-only memory, when validating consts), but I feel like we cannot be paranoid enough here, and also if this ever fails it'll be a nicer error than the "cannot read from mutable memory" error.
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-3/+3
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-28CTFE: exposing pointers and calling extern fn doesn't need an RFC, it is ↵Ralf Jung-0/+1
just impossible
2022-08-28validation should only catch UB errorsRalf Jung-17/+20
2022-08-27interpret: make read-pointer-as-bytes *always* work in MiriRalf Jung-44/+46
and show some extra information when it happens in CTFE
2022-08-27interpret: rename relocation → provenanceRalf Jung-25/+25
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-6/+4
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-27remove a now-useless machine hookRalf Jung-24/+5
2022-08-27remove an ineffective check in const_propRalf Jung-1/+4
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-247/+166
initialized Scalar
2022-08-26remove some now-unnecessary parameters from check_bytesRalf Jung-12/+3
2022-08-26remove enforce_number_init machine hook that Miri no longer needsRalf Jung-24/+8
2022-08-26fix an outdated machine hook nameRalf Jung-7/+7
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-3/+3
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-4/+2
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-1/+1
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-2/+2
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-23extra sanity check against consts pointing to mutable memoryRalf Jung-27/+45
2022-08-19Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkovDylan DPC-1/+6
make NOP dyn casts not require anything about the vtable As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-17Rollup merge of #99972 - RalfJung:1zst, r=lcnrMatthias Krüger-1/+3
interpret: only consider 1-ZST when searching for receiver `repr(transparent)` currently entirely rejects ZST with alignment larger than 1 (which is odd, arguably [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=02870f29396fa948c3123cb53d869ad1) should be accepted), so this should be safe. And if it ever isn't safe then that is very likely a bug elsewhere in the compiler.
2022-08-15Rename Machine memory hooks to suggest when they runBen Kimock-8/+14
2022-08-12Rollup merge of #100229 - RalfJung:extra-const-ub-checks, r=lcnrDylan DPC-12/+4
add -Zextra-const-ub-checks to enable more UB checking in const-eval Cc https://github.com/rust-lang/rust/issues/99923 r? `@oli-obk`
2022-08-11Rollup merge of #100391 - nnethercote:improve-size-assertions, r=lqdDylan DPC-9/+11
Improve size assertions r? `@lqd`
2022-08-10Avoid repeating qualifiers on `static_assert_size` calls.Nicholas Nethercote-9/+11
Some of these don't need a `use` statement because there is already a `#[macro_use] extern crate rustc_data_structures` item in the crate.
2022-08-09dont rely on old macro-in-trait-impl bugRalf Jung-12/+0
2022-08-07add -Zextra-const-ub-checks to enable more UB checking in const-evalRalf Jung-0/+4
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-1/+6
2022-08-05add method to get the mutability of an AllocIdRalf Jung-0/+7
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-30interpret: only consider 1-ZST when searching for receiverRalf Jung-1/+3
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.