about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2022-04-17ptr_get_alloc_id: don't return an actual PointerRalf Jung-30/+29
2022-04-17downgrade really verbose logging to traceRalf Jung-2/+2
2022-04-17interpret: more debug logging for read_scalar and write_scalarRalf Jung-4/+21
2022-04-17add caution to some commentsRalf Jung-1/+1
2022-04-17when writing uninit to an allocation, also clear relocations like other ↵Ralf Jung-5/+10
writes do
2022-04-16Rollup merge of #95426 - b-naber:valtrees-slice, r=RalfJung,oli-obkDylan DPC-26/+58
Include Refs in Valtree Creation This adds references to `const_to_valtree`, which isn't used in the compiler yet, but after the previous changes we made to the thir and mir representations and this change we should be able to finally introduce them in the next PR. I wasn't able to properly test this code, except indirectly by including a call of `const_to_valtree` in the code that currently creates constants (`turn_into_const_value`). r? `@lcnr` cc `@oli-obk` `@RalfJung`
2022-04-16Rollup merge of #96050 - oli-obk:deaggregator_cleanup, r=RalfJungDylan DPC-19/+3
Remove some now-dead code that was only relevant before deaggregation. The code was broken anyway, if the deaggregator is disabled, it would have ICEd on any non-enum Adt r? ```@RalfJung```
2022-04-14handle arrays and slices uniformly in valtree creationb-naber-31/+13
2022-04-14Remove some now-dead code that was only relevant before deaggregation.Oli Scherer-19/+3
The code was broken anyway, if the deaggregator is disabled, it would have ICE on any non-enum Adt
2022-04-13Consider lifetimes when comparing types for equality in MIR validatorJakob Degen-4/+3
2022-04-12use len on mplace instead of reading immediate, remove dead codeb-naber-39/+14
2022-04-11Remove rule that place loads may not happen with variant index setJakob Degen-5/+2
2022-04-11Address various comments and change some details around place to value ↵Jakob Degen-1/+1
conversions
2022-04-11Adjust MIR validator to check a few more things for terminatorsJakob Degen-5/+19
2022-04-11Extend the MIR validator to check many more things around rvalues.Jakob Degen-39/+161
2022-04-11Adjust computation of place types to detect more invalid placesJakob Degen-1/+9
2022-04-11Add new `Deinit` statement kindJakob Degen-29/+92
2022-04-10Avoid accessing HIR from MIR queries.Camille GILLOT-14/+4
2022-04-08use deref on ImmTyb-naber-4/+3
2022-04-08create leafs for slicesb-naber-116/+63
2022-04-07interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internalRalf Jung-50/+60
2022-04-06Auto merge of #95707 - RalfJung:initialized, r=oli-obkbors-4/+22
interp/validity: enforce Scalar::Initialized This is a follow-up to https://github.com/rust-lang/rust/pull/94527, to also account for the new kind of `Scalar` layout inside the validity checker. r? `@oli-obk`
2022-04-06Rollup merge of #95693 - RalfJung:more-context, r=oli-obkDylan DPC-7/+13
interp: pass TyCtxt to Machine methods that do not take InterpCx This just seems like something you might need, so let's consistently have it. One day we might have to add `ParamEnv` as well, though that seems less likely (and in Miri you can always use `reveal_all` anyway). It might make sense to have a type that packages `TyCtxt` and `ParamEnv`, this pairing occurs quite frequently in rustc... r? `@oli-obk`
2022-04-05interp/validity: enforce Scalar::InitializedRalf Jung-4/+22
2022-04-05interp: pass TyCtxt to Machine methods that do not take InterpCxRalf Jung-7/+13
2022-04-05Auto merge of #94527 - oli-obk:undef_scalars, r=nagisa,erikdesjardinbors-18/+27
Let CTFE to handle partially uninitialized unions without marking the entire value as uninitialized. follow up to #94411 To fix https://github.com/rust-lang/rust/issues/69488 and by extension fix https://github.com/rust-lang/rust/issues/94371, we should stop treating types like `MaybeUninit<usize>` as something that the `Scalar` type in the interpreter engine can represent. So we add a new field to `abi::Primitive` that records whether the primitive is nested in a union cc `@RalfJung` r? `@ghost`
2022-04-05mir-interpret now treats unions as non-immediate, even if they have scalar ↵Oli Scherer-7/+11
layout, allowing partially initializing them
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-13/+18
initialized scalars can special case them.
2022-04-03tweak some function namesRalf Jung-14/+14
2022-04-03interpret: remove MemoryExtra in favor of giving access to the MachineRalf Jung-238/+192
2022-04-01Auto merge of #94883 - cjgillot:flat-metadata, r=oli-obkbors-31/+35
Encode even more metadata through tables instead of EntryKind This should move us closer to getting rid of `EntryKind`.
2022-03-31Merge impl_constness and is_const_fn_raw.Camille GILLOT-31/+35
2022-03-31catch overflow in slice size computationRalf Jung-1/+2
2022-03-31audit check_mul uses in interpretRalf Jung-1/+7
2022-03-31interpret: make isize::MAX the limit for dynamic value sizesRalf Jung-8/+10
2022-03-30Auto merge of #95436 - cjgillot:static-mut, r=oli-obkbors-1/+1
Remember mutability in `DefKind::Static`. This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-30Auto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPCbors-8/+8
Rollup of 5 pull requests Successful merges: - #95294 (Document Linux kernel handoff in std::io::copy and std::fs::copy) - #95443 (Clarify how `src/tools/x` searches for python) - #95452 (fix since field version for termination stabilization) - #95460 (Spellchecking compiler code) - #95461 (Spellchecking some comments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-30Spellchecking some commentsYuri Astrakhan-8/+8
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-29Remember mutability in `DefKind::Static`.Camille GILLOT-1/+1
This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-29include refs in valtree creationb-naber-29/+158
2022-03-28Normalize all projections in mir validation againOli Scherer-1/+6
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-8/+16
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-03-26interpret: with enforce_number_validity, ensure integers are truly ↵Ralf Jung-3/+6
Scalar::Int (i.e., no pointers)
2022-03-26interpret: mark a dead match arm as deadRalf Jung-1/+2
2022-03-26Auto merge of #95149 - cjgillot:once-diag, r=estebankbors-2/+2
Remove `Session::one_time_diagnostic` This is untracked mutable state, which modified the behaviour of queries. It was used for 2 things: some full-blown errors, but mostly for lint declaration notes ("the lint level is defined here" notes). It is replaced by the diagnostic deduplication infra which already exists in the diagnostic emitter. A new diagnostic level `OnceNote` is introduced specifically for lint notes, to deduplicate subdiagnostics. As a drive-by, diagnostic emission takes a `&mut` to allow dropping the `SubDiagnostic`s.
2022-03-25Rollup merge of #94655 - JakobDegen:mir-phase-docs, r=oli-obkDylan DPC-28/+48
Clarify which kinds of MIR are allowed during which phases. This enhances documentation with these details and extends the validator to check these requirements more thoroughly. Most of these conditions were already being checked. There was also some disagreement between the `MirPhase` docs and validator as to what it meant for the `body.phase` field to have a certain value. This PR resolves those disagreements in favor of the `MirPhase` docs (which is what the pass manager implemented), adjusting the validator accordingly. The result is now that the `DropLowering` phase begins with the end of the elaborate drops pass, and lasts until the beginning of the generator lowring pass. This doesn't feel entirely natural to me, but as long as it's documented accurately it should be ok. r? rust-lang/mir-opt
2022-03-23Clarify which kinds of MIR are allowed during which phases.Jakob Degen-28/+48
This enhances documentation with these details and extends the validator to check these requirements more thoroughly. As a part of this, we add a new `Deaggregated` phase, and rename other phases so that their names more naturally correspond to what they represent.
2022-03-23Rollup merge of #95221 - RalfJung:check_and_deref_ptr, r=oli-obkMatthias Krüger-15/+5
interpret/memory: simplify check_and_deref_ptr *Finally* I saw a way to make this code simpler. The odd preprocessing in `let ptr_or_addr =` has bothered me since forever, but it actually became unnecessary in the last provenance refactoring. :) This also leads to slightly more explicit error messages as a nice side-effect. :tada: r? `@oli-obk`
2022-03-23Auto merge of #94901 - fee1-dead:destructable, r=oli-obkbors-9/+7
Rename `~const Drop` to `~const Destruct` r? `@oli-obk` Completely switching to `~const Destructible` would be rather complicated, so it seems best to add it for now and wait for it to be backported to beta in the next release. The rationale is to prevent complications such as #92149 and #94803 by introducing an entirely new trait. And `~const Destructible` reads a bit better than `~const Drop`. Name Bikesheddable.
2022-03-22interpret/memory: simplify check_and_deref_ptrRalf Jung-15/+5