about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
AgeCommit message (Collapse)AuthorLines
2023-07-25interpret: read_discriminant: only return VariantIdxRalf Jung-35/+49
2023-07-25interpret: refactor projection code to work on a common trait, and use that ↵Ralf Jung-1067/+685
for visitors
2023-07-24interpret: support projecting into Place::Local without force_allocationRalf Jung-251/+404
2023-07-22Auto merge of #113853 - cjgillot:split-validator, r=compiler-errorsbors-188/+303
Reuse the MIR validator for MIR inlining Instead of having the inliner home-cook its own validation, we just check that the substituted MIR body passes the regular validation. The MIR validation is first split in two: control flow validation (MIR syntax and CFG invariants) and type validation (subtyping relationship in assignments and projections). Only the latter can be affected by instantiating type parameters.
2023-07-21Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"David Tolnay-71/+74
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-21Reuse MIR validator for inliner.Camille GILLOT-1/+1
2023-07-21Make type validation buffer errors.Camille GILLOT-25/+24
2023-07-21Separate CFG validation from type validation.Camille GILLOT-181/+297
2023-07-21Double check that hidden types match the expected hidden typeOli Scherer-3/+8
2023-07-21CTFE: move `target_{i, u}size_{min, max)` to `rustc_abi::TargetDataLayout`Moulins-11/+9
2023-07-21support non-null pointer niches in CTFEMoulins-64/+63
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/+22
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-104/+100
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-33/+54
2023-07-11fix handling of alignment for dyn-sized placesRalf Jung-4/+6
2023-07-11miri: protect Move() function arguments during the callRalf Jung-64/+180
2023-07-08Auto merge of #113376 - ↵bors-23/+24
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-23/+24
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-07Auto merge of #113308 - compiler-errors:poly-select, r=lcnrbors-14/+9
Split `SelectionContext::select` into fns that take a binder and don't *most* usages of `SelectionContext::select` don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out into `SelectionContext::{select,poly_select}` and limit the usages of the latter. Right now, we only have 3 places where we're calling `poly_select` -- fulfillment, internally within the old solver, and the auto-trait finder. r? `@lcnr`
2023-07-06Rollup merge of #111917 - WaffleLapkin:validate_unalloc, r=oli-obkMichael Goulet-14/+9
Simplify duplicate checks for mir validator This removes unnecessary allocations & is less code.
2023-07-06Separate select calls that don't need a binderMichael Goulet-14/+9
2023-07-06Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errorsbors-10/+16
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-10/+16
2023-07-05Name the destructure_mir_constant query appropriatelyOli Scherer-3/+3
2023-07-05Use options instead of errors if the errors are never neededOli Scherer-13/+11
2023-07-05Remove a function argument that is always passed with the same value.Oli Scherer-1/+1
2023-07-05Specialize `DestructuredConstant` to its one user (pretty printing)Oli Scherer-1/+1
2023-07-05Specialize `try_destructure_mir_constant` for its sole userOli Scherer-10/+9
2023-07-02Auto merge of #112718 - oli-obk:SIMD-destructure_mir_const, r=cjgillotbors-1/+0
Make simd_shuffle_indices use valtrees This removes the second-to-last user of the `destructure_mir_constant` query. So in a follow-up we can remove the query and just move the query provider function directly into pretty printing (which is the last user). cc `@rust-lang/clippy` there's a small functional change, but I think it is correct?
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-4/+4
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-06-28remove FIXME and add testJames Dietz-2/+0
2023-06-28add check for ConstKind::Value(_)James Dietz-2/+7
2023-06-27Auto merge of #112693 - ericmarkmartin:use-more-placeref, r=spastorinobors-16/+12
Use PlaceRef abstractions more often Associated issue: https://github.com/rust-lang/rust/issues/80647 r? `@spastorino`
2023-06-26Make simd_shuffle_indices use valtreesOli Scherer-1/+0
2023-06-25use PlaceRef abstractions more consistentlyEric Mark Martin-16/+12
2023-06-24Add enum for `can_access_statics` booleanNilstrieb-15/+36
`/*can_access_statics:*/ false` is one of the ways to do this, but not the one I like.
2023-06-20address most easy commentsZiru Niu-7/+5
2023-06-20merge `BorrowKind::Unique` into `BorrowKind::Mut`Ziru Niu-4/+5
2023-06-19Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naberMichael Goulet-50/+79
Better error for non const `PartialEq` call generated by `match` Resolves #90237
2023-06-19Dedup some type checks in the MIR validatorScott McMurray-76/+57
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-27/+74
2023-06-18Auto merge of #112638 - lqd:rpo, r=cjgillotbors-5/+2
Switch the BB CFG cache from postorder to RPO The `BasicBlocks` CFG cache is interesting: - it stores a postorder, but `traversal::postorder` doesn't use it - `traversal::reverse_postorder` does traverse the postorder cache backwards - we do more RPO traversals than postorder traversals (around 20x on the perf.rlo benchmarks IIRC) but it's not cached - a couple places here and there were manually reversing the non-cached postorder traversal This PR switches the order of the cache, and makes a bit more use of it. This is a tiny win locally, but it's also for consistency and aesthetics. r? `@ghost`
2023-06-18Better error for non const `PartialEq` call generated by `match`Deadbeef-50/+79
2023-06-17Remove even more redundant builtin candidatesMichael Goulet-1/+5
2023-06-17Simplify even more candidatesMichael Goulet-2/+7