about summary refs log tree commit diff
path: root/src/librustc/mir/interpret/value.rs
AgeCommit message (Collapse)AuthorLines
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-683/+0
2020-03-28rename Scalar::{ptr_null -> null_ptr}Ralf Jung-1/+1
2020-03-25add helper method for ptr ops on Scalar; reduce unnecessary large operand of ↵Ralf Jung-43/+30
overflowing_signed_offset
2020-03-25make Size::from* methods generic in the integer type they acceptRalf Jung-2/+2
2020-03-25use checked casts and arithmetic in Miri engineRalf Jung-29/+44
2020-03-23Split long derive lists into two derive attributes.Ana-Maria Mihalache-25/+4
2020-03-18Rollup merge of #69839 - RalfJung:miri-error-cleanup, r=oli-obkMazdak Farrokhzad-6/+7
Miri error reform Some time ago we started moving Miri errors into a few distinct categories, but we never classified all the old errors. That's what this PR does. ~~This is on top of https://github.com/rust-lang/rust/pull/69762; [relative diff](https://github.com/RalfJung/rust/compare/validity-errors...RalfJung:miri-error-cleanup).~~ r? @oli-obk Fixes https://github.com/rust-lang/const-eval/issues/4
2020-03-14add Scalar::from methods for signed integersRalf Jung-0/+26
2020-03-11miri: categorize errors into "unsupported" and "UB"Ralf Jung-6/+7
Also slightly refactor pointer bounds checks to avoid creating unnecessary temporary Errors
2020-03-08Rollup merge of #69326 - JOE1994:os_str_widestring, r=RalfJungMazdak Farrokhzad-0/+10
mir-interpret: add method to read wide strings from Memory Implemented *step2* from [instructions](https://github.com/rust-lang/miri/issues/707#issuecomment-561564057) laid out in rust-lang/miri#707. Added 2 new methods to struct `rustc_mir::interpret::InterpCx`. * `read_os_str_from_wide_str` (src/librustc_mir/interpret/operand.rs) * `write_os_str_to_wide_str` (src/librustc_mir/interpret/place.rs) - used existing logic implemented in [MIRI/src/eval.rs](https://github.com/rust-lang/miri/blob/94732aaf7bf79fd01a4a48d11155c6586b937514/src/eval.rs#L132-L141) These methods are intended to be used for environment variable emulation in Windows.
2020-03-06mir-interpret: add method Memory::read wide_stringJOE1994-0/+10
2020-02-28move ZST assertion up, for better errorsRalf Jung-2/+2
2020-02-28remove ScalarMaybeUndef::to_bits and make Scalar::to_bits privateRalf Jung-9/+4
2020-02-28remove check_raw after reducing it to one use onlyRalf Jung-8/+3
2020-02-28get rid of to_ptrRalf Jung-11/+3
2020-02-28add comment to check_dataRalf Jung-0/+4
2020-02-16Code review changes.Ben Lewis-3/+8
2020-02-15Change const eval to return `ConstValue`, instead of `Const` as the type ↵Ben Lewis-1/+32
inside it shouldn't be used.
2019-12-28Rollup merge of #67604 - christianpoveda:scalar_to_(u|i)64, r=RalfJungOliver Scherer-21/+35
Add Scalar::to_(u|i)16 methods r? @RalfJung
2019-12-26Retire `to_ptr` which should already have no users but still kept getting ↵Oliver Scherer-7/+2
new ones
2019-12-25rewrite scalar to integer methodsChristian Poveda-28/+29
2019-12-25Add Scalar::to_(u|i)16 methodsChristian Poveda-0/+13
2019-12-22Format the worldMark Rousskov-45/+57
2019-12-22Add error message if `Scalar::from_(u)int` failsChristian Poveda-2/+8
2019-12-21Change results to optionsChristian Poveda-6/+6
2019-12-14add Scalar::try_from_(u)int methodsChristian Poveda-12/+22
2019-12-02Add From instances for Pointer -> ScalarMaybeUndef and Pointer -> ImmediateRalf Jung-0/+7
2019-11-22Allow miri allocation interning to work im generic MachinesWesley Wiser-1/+1
This is necessary so that the `ComstPropMachine` can intern allocations.
2019-11-19More HashStable.Camille GILLOT-6/+1
2019-11-12Remove cruft.Camille GILLOT-10/+0
2019-11-12Create intermediate enum ty::ConstKind.Camille GILLOT-35/+11
2019-11-08miri: Rename to_{u,i}size to to_machine_{u,i}sizeRalf Jung-6/+6
Having a function `to_usize` that does not return a usize is somewhat confusing
2019-10-21Rollup merge of #65660 - varkor:canonical-const-to-bound-const, r=eddybMazdak Farrokhzad-1/+6
Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)` It already has the right form, so this is just a renaming. Fixes https://github.com/rust-lang/rust/issues/65655. r? @eddyb
2019-10-21Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`varkor-1/+6
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-2/+2
2019-10-04Introduce a special case in `IntRange::from_const`.Nicholas Nethercote-3/+8
The `if let Some(val) = value.try_eval_bits(...)` branch in `from_const()` is very hot for the `unicode_normalization` benchmark. This commit introduces a special-case alternative for scalars that avoids `try_eval_bits()` and all the functions it calls (`Const::eval()`, `ConstValue::try_to_bits()`, `ConstValue::try_to_scalar()`, and `Scalar::to_bits()`), instead extracting the result immediately. The type and value checking done by `Scalar::to_bits()` is replicated by moving it into a new function `Scalar::check_raw()` and using that new function in the special case. PR #64673 introduced some special-case handling of scalar types in `Const::try_eval_bits()`. This handling is now moved out of that function into the new `IntRange::integral_size_and_signed_bias` function. This commit reduces the instruction count for `unicode_normalization-check-clean` by about 10%.
2019-09-28Move `get_slice_bytes` to `rustc::mir::interpret` so it can be reused.ben-0/+15
2019-09-14Rollup merge of #64116 - ZeGentzy:patch-1, r=oli-obkMazdak Farrokhzad-2/+2
Fix minor typo in docs. This comment is prolly refering to the comment in [const_eval_raw_provider](https://github.com/rust-lang/rust/pull/64116/files#diff-e0b58bb6712edaa8595ad7237542c958R616), not itself.
2019-09-13Update value.rsHal Gentz-2/+2
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: librustcAlexander Regueiro-5/+5
2019-09-03Update other doc.Hal Gentz-2/+2
Value was renamed to Operand in https://github.com/rust-lang/rust/commit/ad2de8b4ee099916113b7b3577ac86857b1568be ScalarPair to Slice in https://github.com/rust-lang/rust/commit/fe50b4eb1d6f7a31c53798bca3d0fa2b0670fa3d Not familiar enough with rustc's source to know if the comment is even still applicable.
2019-08-17size has a zeroDante-Broggi-1/+1
2019-08-02CTFE: simplify Value type by not checking for alignmentRalf Jung-10/+3
2019-07-30renaming throw_err_* to throw_*Saleem Jaffer-6/+6
2019-07-30renaming err to err_unsupSaleem Jaffer-6/+6
2019-07-30adding throw_ and err_ macros for InterpErrorSaleem Jaffer-6/+6
2019-07-29adding a err macro for each of the InterpError variantsSaleem Jaffer-7/+6
2019-07-29fixing fallout due to InterpError refactorSaleem Jaffer-6/+7
2019-07-06remove another unused methodRalf Jung-13/+0
2019-07-06add assert_{bits,ptr}; document which methods we hope to get rid ofRalf Jung-0/+20