about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
AgeCommit message (Collapse)AuthorLines
2023-08-06simplify handling of valtrees for unsized typesRalf Jung-11/+15
2023-08-06Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJungMatthias Krüger-1/+1
Add documentation to has_deref Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose. cc https://github.com/rust-lang/rust/issues/114401 r? `@RalfJung`
2023-08-06cleanup misinformation regarding has_derefouz-a-1/+1
2023-08-06interpret: use ConstPropNonsense for more const-prop induced issuesRalf Jung-4/+5
2023-08-04interpret: add mplace_to_ref helper methodRalf Jung-6/+14
2023-08-03Rollup merge of #114372 - RalfJung:const-pointer-as-int, r=oli-obkMatthias Krüger-45/+57
const validation: point at where we found a pointer but expected an integer Instead of validation just printing "unable to turn pointer into bytes", make this a regular validation error that says where in the value the bad pointer was found. Also distinguish "expected integer, got pointer" from "expected pointer, got partial pointer or mix of pointers". To avoid duplicating things too much I refactored the diagnostics for validity a bit, so that "got uninit, expected X" and "got pointer, expected X" can share the "X" part. Also all the errors emitted for validation are now grouped under `const_eval_validation` so that they are in a single group in the ftl file. r? `@oli-obk`
2023-08-03Rollup merge of #114363 - RalfJung:interpret-not-miri, r=jackh726Matthias Krüger-2/+2
avoid 'miri' when refering to the shared interpreter This is basically the rustc source code version of https://github.com/rust-lang/rustc-dev-guide/pull/1471.
2023-08-02const validation: point at where we found a pointer but expected an integerRalf Jung-45/+57
2023-08-02avoid 'miri' when refering to the shared interpreterRalf Jung-2/+2
2023-08-02Auto merge of #114333 - RalfJung:dangling-ptr-offset, r=oli-obkbors-19/+24
Miri: fix error on dangling pointer inbounds offset We used to claim that the pointer was "dereferenced", but that is just not true. Can be reviewed commit-by-commit. The first commit is an unrelated rename that didn't seem worth splitting into its own PR. r? `@oli-obk`
2023-08-01properly track why we checked whether a pointer is in-boundsRalf Jung-10/+16
also simplify the in-bounds checking in Miri's borrow trackers
2023-08-01rename deref_operand → deref_pointer and some Miri helper functionsRalf Jung-9/+8
2023-07-31fix alignment handling for Repeat expressionsRalf Jung-4/+4
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-5/+2
2023-07-27Rollup merge of #114075 - matthiaskrgr:fmt_args_rustc_3, r=wesleywiserMatthias Krüger-28/+20
inline format!() args from rustc_codegen_llvm to the end (4) r? `@WaffleLapkin`
2023-07-25inline format!() args from rustc_codegen_llvm to the end (4)Matthias Krüger-28/+20
r? @WaffleLapkin
2023-07-25make MPlaceTy non-CopyRalf Jung-10/+10
2023-07-25interpret: make read functions generic over operand typeRalf Jung-77/+79
2023-07-25interpret: make write functions generic over the place typeRalf Jung-135/+165
2023-07-25add some sanity checks in write_immediate_no_validateRalf Jung-3/+28
2023-07-25interpret: read_discriminant: only return VariantIdxRalf Jung-33/+47
2023-07-25interpret: refactor projection code to work on a common trait, and use that ↵Ralf Jung-1049/+660
for visitors
2023-07-24interpret: support projecting into Place::Local without force_allocationRalf Jung-247/+402
2023-07-21Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"David Tolnay-66/+64
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
2023-07-21Auto merge of #113892 - RalfJung:uninit-undef-poison, r=wesleywiserbors-1/+1
clarify MIR uninit vs LLVM undef/poison In [this LLVM discussion](https://discourse.llvm.org/t/rfc-load-instruction-uninitialized-memory-semantics/67481) I learned that mapping our uninitialized memory in MIR to poison in LLVM would be quite problematic due to the lack of a byte type. I am not sure where to write down this insight but this seems like a reasonable start.
2023-07-21CTFE: move `target_{i, u}size_{min, max)` to `rustc_abi::TargetDataLayout`Moulins-7/+6
2023-07-21support non-null pointer niches in CTFEMoulins-58/+61
2023-07-20clarify MIR uninit vs LLVM undef/poisonRalf Jung-1/+1
2023-07-16Refactor checking function target features during const-evalEduardo Sánchez Muñoz-18/+29
* Split into its own function * Do not build a `Vec` of unavailable features
2023-07-16miri: fail when calling a function that requires an unavailable target featureEduardo Sánchez Muñoz-0/+19
miri will report an UB when calling a function that has a `#[target_feature(enable = ...)]` attribute is called and the required feature is not available. "Available features" are the same that `is_x86_feature_detected!` (or equivalent) reports to be available during miri execution (which can be enabled or disabled with the `-C target-feature` flag).
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-37/+35
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-17/+36
2023-07-11fix handling of alignment for dyn-sized placesRalf Jung-4/+6
2023-07-11miri: protect Move() function arguments during the callRalf Jung-59/+173
2023-07-08Auto merge of #113376 - ↵bors-14/+15
Nilstrieb:pointer-coercions-are-not-casts-because-that-sounds-way-to-general-aaaa, r=oli-obk Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sounds like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a little enum variants. Make it clear there these are only coercions and that people who see this and think "why are so many pointer related casts not in these variants" aren't insane. This enum was added in #59987. I'm not sure whether the variant sharing is actually worth it, but this at least makes it less confusing. r? oli-obk
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-14/+15
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-07miri: check that assignments do not self-overlapRalf Jung-1/+6
2023-07-06Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errorsbors-7/+12
Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Part of rust-lang/compiler-team#616 turns out there's a lot of places we construct `Ty` this is a ridiculously huge PR :S r? `@oli-obk`
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-7/+12
2023-07-05Remove a function argument that is always passed with the same value.Oli Scherer-1/+1
2023-07-05Specialize `try_destructure_mir_constant` for its sole userOli Scherer-1/+1
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-1/+1
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-06-19Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naberMichael Goulet-1/+1
Better error for non const `PartialEq` call generated by `match` Resolves #90237
2023-06-19Dedup some type checks in the MIR validatorScott McMurray-26/+4
2023-06-19Remove unchecked_add/sub/mul/shl/shr from CTFE/cg_ssa/cg_clifScott McMurray-31/+0
2023-06-19Promote unchecked_add/sub/mul/shl/shr to mir::BinOpScott McMurray-25/+49
2023-06-18Better error for non const `PartialEq` call generated by `match`Deadbeef-1/+1
2023-06-04Use 128 bits for TypeId hashThom Chiovoloni-2/+2
- Switch TypeId to 128 bits - Hack around the fact that tracing-subscriber dislikes how TypeId is hashed - Remove lowering of type_id128 from rustc_codegen_llvm - Remove unnecessary `type_id128` intrinsic (just change return type of `type_id`) - Only hash the lower 64 bits of the TypeId - Reword comment
2023-06-02Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obkMichael Goulet-5/+1
Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem` As described in <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BinOp.html#variant.Div>, the ordinary `BinOp`s for these are already UB for division by zero ([or overflow](https://llvm.org/docs/LangRef.html#sdiv-instruction), [demo](https://rust.godbolt.org/z/71e7P7Exh)), as MIR building is responsible for inserting code to panic for those cases regardless of whether the overflow checks are enabled. So we can lower these in the same arm that lowers `wrapping_add` to MIR `BinOp::Add` and such, as all these cases turn into ordinary `Rvalue::BinaryOp`s.
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-228/+260