about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2024-05-09Make builtin_deref just return a TyMichael Goulet-9/+9
2024-05-09interpret/miri: better errors on failing offset_fromRalf Jung-13/+16
2024-05-07replace another Option<Span> by DUMMY_SPRalf Jung-10/+10
2024-05-04Rollup merge of #124720 - RalfJung:interpret-drop, r=compiler-errorsMatthias Krüger-6/+9
interpret: Drop: always evaluate place That way we can also avoid dealing with `instantiate_from_frame_and_normalize_erasing_regions`.
2024-05-04some comments or dynamic drop handlingRalf Jung-0/+6
2024-05-04interpret: Drop: always evaluate placeRalf Jung-6/+3
2024-05-04interpret, miri: uniform treatments of intrinsics/functions with and without ↵Ralf Jung-20/+5
return block
2024-05-04Rollup merge of #124293 - oli-obk:miri_intrinsic_fallback_body, r=RalfJungMatthias Krüger-12/+46
Let miri and const eval execute intrinsics' fallback bodies fixes https://github.com/rust-lang/miri/issues/3397 r? ``@RalfJung``
2024-05-03Ensure miri only uses fallback bodies that have manually been vetted to ↵Oli Scherer-1/+2
preserve all UB that the native intrinsic would have
2024-05-03Let miri and const eval execute intrinsics' fallback bodiesOli Scherer-12/+45
2024-05-02interpret: hide some reexports in rustdocRalf Jung-0/+1
2024-04-23properly fill a promoted's required_constsRalf Jung-23/+4
then we can also make all_required_consts_are_checked a constant instead of a function
2024-04-23interpret: sanity-check that required_consts captures all consts that can failRalf Jung-13/+36
2024-04-23Auto merge of #124302 - matthiaskrgr:rollup-2aya8n8, r=matthiaskrgrbors-10/+21
Rollup of 3 pull requests Successful merges: - #124003 (Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics)) - #124169 (Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`) - #124286 (Subtree sync for rustc_codegen_cranelift) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-23Rollup merge of #124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyoMatthias Krüger-10/+21
Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements https://github.com/rust-lang/compiler-team/issues/693 minus what was implemented in #123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
2024-04-23Rollup merge of #122598 - Nadrieril:full-derefpats, r=matthewjasperLeón Orell Valerian Liehr-4/+4
deref patterns: lower deref patterns to MIR This lowers deref patterns to MIR. This is a bit tricky because this is the first kind of pattern that requires storing a value in a temporary. Thanks to https://github.com/rust-lang/rust/pull/123324 false edges are no longer a problem. The thing I'm not confident about is the handling of fake borrows. This PR ignores any fake borrows inside a deref pattern. We are guaranteed to at least fake borrow the place of the first pointer value, which could be enough, but I'm not certain.
2024-04-23Rollup merge of #124220 - RalfJung:interpret-wrong-vtable, r=oli-obkMatthias Krüger-24/+67
Miri: detect wrong vtables in wide pointers Fixes https://github.com/rust-lang/miri/issues/3497. Needed to catch the UB that https://github.com/rust-lang/rust/pull/123572 will start exploiting. r? `@oli-obk`
2024-04-23Auto merge of #121801 - zetanumbers:async_drop_glue, r=oli-obkbors-0/+1
Add simple async drop glue generation This is a prototype of the async drop glue generation for some simple types. Async drop glue is intended to behave very similar to the regular drop glue except for being asynchronous. Currently it does not execute synchronous drops but only calls user implementations of `AsyncDrop::async_drop` associative function and awaits the returned future. It is not complete as it only recurses into arrays, slices, tuples, and structs and does not have same sensible restrictions as the old `Drop` trait implementation like having the same bounds as the type definition, while code assumes their existence (requires a future work). This current design uses a workaround as it does not create any custom async destructor state machine types for ADTs, but instead uses types defined in the std library called future combinators (deferred_async_drop, chain, ready_unit). Also I recommend reading my [explainer](https://zetanumbers.github.io/book/async-drop-design.html). This is a part of the [MCP: Low level components for async drop](https://github.com/rust-lang/compiler-team/issues/727) work. Feature completeness: - [x] `AsyncDrop` trait - [ ] `async_drop_in_place_raw`/async drop glue generation support for - [x] Trivially destructible types (integers, bools, floats, string slices, pointers, references, etc.) - [x] Arrays and slices (array pointer is unsized into slice pointer) - [x] ADTs (enums, structs, unions) - [x] tuple-like types (tuples, closures) - [ ] Dynamic types (`dyn Trait`, see explainer's [proposed design](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#async-drop-glue-for-dyn-trait)) - [ ] coroutines (https://github.com/rust-lang/rust/pull/123948) - [x] Async drop glue includes sync drop glue code - [x] Cleanup branch generation for `async_drop_in_place_raw` - [ ] Union rejects non-trivially async destructible fields - [ ] `AsyncDrop` implementation requires same bounds as type definition - [ ] Skip trivially destructible fields (optimization) - [ ] New [`TyKind::AdtAsyncDestructor`](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#adt-async-destructor-types) and get rid of combinators - [ ] [Synchronously undroppable types](https://github.com/zetanumbers/posts/blob/main/async-drop-design.md#exclusively-async-drop) - [ ] Automatic async drop at the end of the scope in async context
2024-04-22Rollup merge of #124230 - reitermarkus:generic-nonzero-stable, r=dtolnayGuillaume Gomez-1/+0
Stabilize generic `NonZero`. Tracking issue: https://github.com/rust-lang/rust/issues/120257 r? `@dtolnay`
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-21Address PR feedbackScott McMurray-15/+12
2024-04-21Use it in the library, and `InstSimplify` it away in the easy placesScott McMurray-1/+27
2024-04-21Add an intrinsic that lowers to AggregateKind::RawPtrScott McMurray-1/+4
2024-04-21Add `AggregateKind::RawPtr` and enough support to compileScott McMurray-0/+38
2024-04-21Miri: detect wrong vtables in wide pointersRalf Jung-24/+67
2024-04-20Add a non-shallow fake borrowNadrieril-4/+4
2024-04-19Auto merge of #124113 - RalfJung:interpret-scalar-ops, r=oli-obkbors-58/+82
interpret: use ScalarInt for bin-ops; avoid PartialOrd for ScalarInt Best reviewed commit-by-commit r? `@oli-obk`
2024-04-19ScalarInt: add methods to assert being a (u)int of given sizeRalf Jung-7/+6
2024-04-18interpret/binary_int_op: avoid dropping to raw ints until we determined the signRalf Jung-56/+81
2024-04-18Auto merge of #124008 - nnethercote:simpler-static_assert_size, r=Nilstriebbors-2/+2
Simplify `static_assert_size`s. We want to run them on all 64-bit platforms. r? `@ghost`
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-2/+2
We want to run them on all 64-bit platforms.
2024-04-18Auto merge of #122684 - oli-obk:delay_interning_errors_to_after_validaiton, ↵bors-87/+129
r=RalfJung Delay interning errors to after validation fixes https://github.com/rust-lang/rust/issues/122398 fixes #122548 This improves diagnostics since validation errors are usually more helpful compared with interning errors that just make broad statements about the entire constant r? `@RalfJung`
2024-04-17Rollup merge of #124030 - RalfJung:adjust_alloc_base_pointer, r=oli-obkMatthias Krüger-26/+39
interpret: pass MemoryKind to adjust_alloc_base_pointer Another puzzle piece for https://github.com/rust-lang/miri/pull/3475. The 2nd commit renames base_pointer -> root_pointer; that's how Tree Borrows already calls them and I think the term is more clear than "base pointer". In particular, this distinguishes it from "base address", since a root pointer can point anywhere into an allocation, not just its base address. https://github.com/rust-lang/rust/pull/124018 has been rolled up already so I couldn't add it there any more. r? ```@oli-obk```
2024-04-17Use less fragile error handlingOli Scherer-18/+16
2024-04-17Validate before reporting interning errors.Oli Scherer-23/+52
validation produces much higher quality errors and already handles most of the cases
2024-04-17Simplify alloc id mutability checkOli Scherer-10/+15
2024-04-17Deduplicate logic for checking the mutability of allocationsOli Scherer-79/+75
2024-04-17Run the "is this static mutable" logic the same way as in `in_mutable_memory`Oli Scherer-14/+16
2024-04-17Validate nested static itemsOli Scherer-7/+19
2024-04-17interpret: rename base_pointer -> root_pointerRalf Jung-18/+18
also in Miri, "base tag" -> "root tag"
2024-04-17interpret: pass MemoryKind to adjust_alloc_base_pointerRalf Jung-11/+24
2024-04-17Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errorsMatthias Krüger-6/+7
Qualifier tweaking Adding and removing qualifiers in some cases that make things nicer. Details in individual commits. r? `@compiler-errors`
2024-04-17Rollup merge of #123675 - oli-obk:static_wf_ice, r=compiler-errorsGuillaume Gomez-0/+5
Taint const qualifs if a static is referenced that didn't pass wfcheck It is correct to only check the signature here, as the ICE is caused by `USE_WITH_ERROR` trying to allocate memory to store the result of `WITH_ERROR` before evaluating it. fixes #123153
2024-04-16Add simple async drop glue generationzetanumbers-0/+1
Explainer: https://zetanumbers.github.io/book/async-drop-design.html https://github.com/rust-lang/rust/pull/121801
2024-04-16Rollup merge of #124024 - RalfJung:interpret-comment, r=oli-obkMatthias Krüger-3/+0
interpret: remove outdated comment In https://github.com/rust-lang/rust/pull/107756, allocation became generally fallible, so the "only panic if there is provenance" no longer applies. r? ``@oli-obk``
2024-04-16interpret: remove outdated commentRalf Jung-3/+0
2024-04-16interpret: pass MemoryKind to before_memory_deallocationRalf Jung-0/+2
2024-04-16Add an assertion in const evalMaybe Waffle-2/+8
2024-04-16Change intrinsic types to use `u32` instead of `T` to match stable reexportsMaybe Waffle-8/+13
2024-04-16Taint const qualifs if a static is referenced that didn't pass wfcheckOli Scherer-0/+5