about summary refs log tree commit diff
path: root/src/librustc_mir/interpret
AgeCommit message (Collapse)AuthorLines
2019-07-28get_size_and_align: fix handling of function pointersRalf Jung-9/+15
2019-07-28miri: add get and get_mut to AllocMap; use that in get_size_and_align and ↵Ralf Jung-38/+52
avoid rightwards drift
2019-07-28the alignment checks on access can no longer fail nowRalf Jung-4/+10
2019-07-28discourage use of ref_to_mplaceRalf Jung-0/+4
2019-07-28check that ptr is valid already when doing Deref, not only when doing the accessRalf Jung-1/+10
2019-07-27Rollup merge of #62982 - oli-obk:static_cycle, r=RalfJungMazdak Farrokhzad-34/+41
Don't access a static just for its size and alignment cc @RalfJung fixes #62189
2019-07-26Rollup merge of #62801 - bjorn3:remove_lower_128bit_ops, r=alexcrichtonMazdak Farrokhzad-13/+2
Remove support for -Zlower-128bit-ops It is broken and unused cc https://github.com/rust-lang/rust/issues/58969 blocked https://github.com/rust-lang-nursery/compiler-builtins/pull/302 (removes definitions of the lang items removed in this PR) r? @alexcrichton
2019-07-26Update src/librustc_mir/interpret/memory.rsOliver Scherer-1/+1
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-07-26Update src/librustc_mir/interpret/memory.rsOliver Scherer-1/+1
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-07-26Address review commentsOliver Scherer-7/+11
2019-07-26Clear up `get_size_and_align`Oliver Scherer-34/+37
2019-07-26Fix tidyOliver Scherer-1/+1
2019-07-25Rewrite `get_size_and_align` so it doesn't duplicate workOliver Scherer-34/+35
2019-07-25Don't access a static just for its size and alignmentOliver Scherer-14/+13
2019-07-24use PanicMessage type for MIR assertion errorsRalf Jung-16/+19
2019-07-23Rollup merge of #60951 - saleemjaffer:mir_better_error_enum, r=oli-obkMark Rousskov-17/+21
more specific errors in src/librustc/mir/interpret/error.rs Implements [this](https://github.com/rust-rfcs/const-eval/issues/4)
2019-07-23renames EvalErrorPanic to PanicMessageSaleem Jaffer-21/+21
2019-07-23moving some variants from InterpError to EvalErrorPanicSaleem Jaffer-14/+18
2019-07-20alters the panic variant of InterpErrorSaleem Jaffer-3/+3
2019-07-20Migrate from Place enum to Place structSantiago Pastorino-3/+2
2019-07-19Remove support for -Zlower-128bit-opsbjorn3-13/+2
It is broken and unused
2019-07-15Rollup merge of #62673 - RalfJung:validity-msg, r=oli-obkMark Rousskov-2/+2
miri validation: better error messages for dangling references Cc @oli-obk
2019-07-14remove outdated commentRalf Jung-1/+0
2019-07-14RustIntrinsic and PlatformIntrinsic are also the same ABI as RustRalf Jung-1/+7
2019-07-14miri validation: better error messages for dangling referencesRalf Jung-2/+2
2019-07-13Rollup merge of #62585 - ↵Mazdak Farrokhzad-3/+7
pnkfelix:issue-60431-make-struct-tail-normalize-when-possible, r=eddyb Make struct_tail normalize when possible As noted in commit message: this replaces the existing methods to extract the struct tail(s) with new entry points that make the handling of normalization explicit. Most of the places that call `struct_tail` are during codegen, post type-checking, and therefore they can get away with using `tcx.normalize_erasing_regions` (this is the entry point `struct_tail_erasing_lifetimes`) For other cases that may arise, one can use the core method, which is parameterized over the normalization `Ty -> Ty` closure (`struct_tail_with_normalize`). Or one can use the trivial entry point that does not normalization (`struct_tail_without_normalization`) ---- I spent a little while trying to make a test that exposed the bug via `impl Trait` rather than a projection, but I failed to find something that tripped up the current nightly `rustc`. * I have *not* spent any time trying to make tests that trip up the other places where `struct_tail` was previously being called. While I do think the task of making such tests could be worthwhile, I am simply running out of time. (Its also possible that the layout code is always the first point called, and thus it may be pointless to try to come up with such tests.) I also spent a little time discussing with @eddyb where this code should live. They suggested moving `struct_tail` and its sibling `struct_lockstep_tails` to the `LayoutCx`. But in the interest of time, I have left that refactoring (which may be questionable at this point) to a follow-up task. ---- Fix #60431
2019-07-12Replace `struct_tail` and `struct_lockstep_tails` with variants handling ↵Felix S. Klock II-3/+7
normalization. The old struct tail functions did not deal with `<T as Trait>::A` and `impl Trait`, at least not explicitly. (We didn't notice this bug before because it is only exposed when the tail (post deep normalization) is not `Sized`, so it was a rare case to deal with.) For post type-checking (i.e. during codegen), there is now `struct_tail_erasing_lifetimes` and `struct_lockstep_tails_erasing_lifetimes`, which each take an additional `ParamEnv` argument to drive normalization. For pre type-checking cases where normalization is not needed, there is `struct_tail_without_normalization`. (Currently, the only instance of this is `Expectation::rvalue_hint`.) All of these new entrypoints work by calling out to common helper routines. The helpers are parameterized over a closure that handles the normalization.
2019-07-10Auto merge of #62441 - RalfJung:place-ptr-normalization, r=oli-obkbors-90/+110
Miri: Provide pointer forcing methods for MemPlace and Op These are useful when one wants to to a lot of work with some place or operand and not to int-to-ptr casts all the time. In particular, this is needed to fix some test failures in Miri: we need to normalize before starting a visitor that walks a run-time value, so that we can later be sure (during the visitor walk) that we have a proper `Pointer`. Also see the Miri side at https://github.com/rust-lang/miri/pull/830. Cc @eddyb @oli-obk
2019-07-06normalize use of backticks/lowercase in compiler messages for librustc_mirSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532 r? @alexreg
2019-07-06forcing instead of normalizationRalf Jung-12/+17
Normalziation does not work well for dyamically sized types
2019-07-06remove outdated commentRalf Jung-2/+0
2019-07-06remove some no-longer-needed methodsRalf Jung-26/+1
2019-07-06Add check_mplace_ptr convenience method; provide ptr-normalization methods ↵Ralf Jung-65/+107
for mplace and op to avoid repeated int-to-ptr casting during validation. Also change Memory::copy to work on `Pointer` instead of `Scalar`. Also rename some methods from to_* to assert_* that will panic if their precondition is not met.
2019-07-06Rollup merge of #62264 - RalfJung:inline-forcing, r=zackmdavisMazdak Farrokhzad-59/+63
Fix perf regression from Miri Machine trait changes Maybe this fixes the perf regression that https://github.com/rust-lang/rust/pull/62003 seemingly introduced? Cc @nnethercote
2019-07-06Rollup merge of #62257 - RalfJung:miri-c-str, r=estebankMazdak Farrokhzad-0/+10
forward read_c_str method from Memory to Alloc This is more convenient to call when one starts with a `Scalar` (which is the common case). `read_c_str` is only used in Miri.
2019-07-06Rollup merge of #62245 - RalfJung:miri-extra-fn, r=eddyb,zackmdavisMazdak Farrokhzad-85/+154
Miri engine: support extra function (pointer) values We want to add basic support for `dlsym` in Miri (needed to run the latest version of `getrandom`). For that to work, `dlsym` needs to return *something* that can be stored in a function pointer and later called. So we add a new `ExtraFnVal` type to the `Machine` trait, and enable Miri's memory to associate allocation IDs with such values, so that `create_fn_alloc` and `get_fn` can work on *both* `Instance` (this is used for "normal" function pointers) and `ExtraFnVal`. Cc @oli-obk
2019-07-04improve validity error range printing for singleton rangesRalf Jung-8/+9
2019-07-04turns out that dangling pointer branch is dead code; remove it and improve ↵Ralf Jung-12/+9
the error that actually gets shown a bit
2019-07-04use get_size_and_align to test if an allocation is liveRalf Jung-10/+9
2019-07-04organize methods a bit betterRalf Jung-36/+38
2019-07-04more inliningRalf Jung-6/+8
2019-07-04make Memory::get_fn take a Scalar like most of the Memory API surfaceRalf Jung-9/+10
2019-07-04fix for tidyRalf Jung-1/+1
2019-07-04fix determinig the size of foreign static allocationsRalf Jung-5/+19
2019-07-04add machine hook to handle calls to 'extra' function valuesRalf Jung-1/+16
2019-07-04Add basic support for "other" kinds of values for function pointers, ↵Ralf Jung-64/+106
determined by the machine instance. So far, however, calling such a function will fail.
2019-07-04Go back to just passing MemoryExtra to the machine-level allocation hooksRalf Jung-10/+10
This is needed to avoid doing unnecessary global alloc_map lookups
2019-07-04Machine: make self-like parameters come firstRalf Jung-12/+12
2019-07-04Fix merge conflictsChristian Poveda-68/+79
2019-07-04Rollup merge of #62295 - RalfJung:miri-realloc, r=cramertjMazdak Farrokhzad-6/+9
miri realloc: do not require giving old size+align