about summary refs log tree commit diff
path: root/src/librustc_mir/interpret/traits.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-182/+0
2020-08-01Auto merge of #74717 - ↵bors-4/+4
davidtwco:issue-74636-polymorphized-closures-inherited-params, r=oli-obk mir: add `used_generic_parameters_needs_subst` Fixes #74636. This PR adds a `used_generic_parameters_needs_subst` helper function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. This is used in the MIR interpreter to make the check for some pointer casts and for reflection intrinsics more precise. I've opened this as a draft PR because this might not be the approach we want to fix this issue and we have to decide what to do about the reflection case. r? @eddyb cc @lcnr @wesleywiser
2020-07-31interp: needs_subst -> ensure_monomorphic_enoughDavid Wood-4/+4
This commit adds a `ensure_monomorphic_enough` utility function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. `ensure_monomorphic_enough` is then used throughout interpret where `needs_subst` checks previously existed (in particular, for some pointer casts and for reflection intrinsics more precise). Signed-off-by: David Wood <david@davidtw.co>
2020-07-22renamed ScalarMaybeUninit::not_undef to check_initPhilippe Nadon-4/+4
Renamed the function ScalarMaybeUninit::not_undef to ScalarMaybeUninit::check_init in the file src/librustc_middle/mir/interpret/value.rs, to reflect changes in terminology used. Related issue rust-lang#71193
2020-07-20mir: `unused_generic_params` queryDavid Wood-1/+1
This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-06-14keep root_span and tcx togetherRalf Jung-4/+4
2020-06-12make miri InterpCx TyCtxtAt a TyCtxt, and separately remember the root span ↵Ralf Jung-16/+16
of the evaluation
2020-05-06try_validation: handle multi-branching, and use macro for most remaining ↵Ralf Jung-4/+1
manual throw_validation_failure sites
2020-05-06properly catch invalid-drop-fn errorsRalf Jung-4/+2
2020-04-15Make the necessary changes to support concurrency in Miri.Vytautas Astrauskas-1/+1
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-3/+3
2020-03-25go back to infix ops for SizeRalf Jung-4/+2
2020-03-25miri: avoid a bunch of casts by offering usized-based field indexingRalf Jung-3/+4
2020-03-25use checked casts and arithmetic in Miri engineRalf Jung-3/+6
2020-01-05Use Instance.ty_env instead of Instance.monomorphic_ty in interpreterAaron Hill-1/+1
2020-01-05Rename Instance.ty to Instance.monomorphic_tyAaron Hill-1/+1
2019-12-22Format the worldMark Rousskov-52/+49
2019-12-12dont ICE in case of invalid drop fnRalf Jung-1/+12
2019-12-02Add From instances for Pointer -> ScalarMaybeUndef and Pointer -> ImmediateRalf Jung-2/+2
2019-11-21Aggregation of drive-by cosmetic changes.Alexander Regueiro-11/+11
2019-11-11UpdateAaron Hill-1/+1
2019-11-11Some cleanupAaron Hill-0/+21
2019-11-08rename Memory::get methods to get_raw to indicate their unchecked natureRalf Jung-19/+14
2019-08-30miri: detect too large dynamically sized objectsRalf Jung-1/+6
2019-08-24Ensure miri can do bit ops on pointer valuesOliver Scherer-2/+4
2019-08-19rustc_mir: disallow non-monomorphic vtables.Eduard-Mihai Burtescu-1/+6
2019-08-19rustc_mir: remove wrong calls to subst_from_frame_and_normalize_erasing_regions.Eduard-Mihai Burtescu-1/+0
2019-08-19start cleaning up subst messRalf Jung-1/+1
fix an ICE fix method name
2019-07-30adding throw_ and err_ macros for InterpErrorSaleem Jaffer-1/+1
2019-07-30addding an interp_error moduleSaleem Jaffer-3/+3
2019-07-29fixing fallout due to InterpError refactorSaleem Jaffer-2/+2
2019-07-04make Memory::get_fn take a Scalar like most of the Memory API surfaceRalf Jung-1/+1
2019-07-04Add basic support for "other" kinds of values for function pointers, ↵Ralf Jung-4/+6
determined by the machine instance. So far, however, calling such a function will fail.
2019-06-27rename InterpretCx -> InterpCxRalf Jung-2/+2
That's more consistent with InterpResult and InterpError.
2019-06-23make code more symmetricRalf Jung-3/+5
2019-06-23Centralize bounds, alignment and NULL checking for memory accesses in one ↵Ralf Jung-5/+15
function: memory.check_ptr_access That function also takes care of converting a Scalar to a Pointer, should that be needed. Not all accesses need that though: if the access has size 0, None is returned. Everyone accessing memory based on a Scalar should use this method to get the Pointer they need. All operations on the Allocation work on Pointer inputs and expect all the checks to have happened (and will ICE if the bounds are violated). The operations on Memory work on Scalar inputs and do the checks themselves. The only other public method to check pointers is memory.ptr_may_be_null, which is needed in a few places. With this, we can make all the other methods (tests for a pointer being in-bounds and checking alignment) private helper methods, used to implement the two public methods. That maks the public API surface much easier to use and harder to mis-use. While I am at it, this also removes the assumption that the vtable part of a `dyn Trait`-fat-pointer is a `Pointer` (as opposed to a pointer cast to an integer, stored as raw bits).
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-1/+1
2019-06-08rename EvalResult -> InterpResult and EvalError -> InterpErrorInfoRalf Jung-4/+4
2019-06-02deduplicate ty::Instance constructorsMark Mansi-2/+3
2019-06-02cache tag for vtable; fn_alloc's don't have a stack nor tagRalf Jung-4/+4
2019-04-28Fix lint findings in librustc_mirflip1995-1/+1
2019-04-16Miri: refactor new allocation taggingRalf Jung-1/+1
2019-04-12Auto merge of #59536 - Zoxc:the-arena, r=eddybbors-2/+1
Introduce an arena type which may be used to allocate a list of types with destructors You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena. Based on https://github.com/rust-lang/rust/pull/59517 and https://github.com/rust-lang/rust/pull/59533. Look at the last commit for the interesting changes. An alternative to https://github.com/rust-lang/rust/pull/56448. cc @michaelwoerister @eddyb r? @oli-obk
2019-04-08Apply suggestions from code review Ralf Jung-1/+1
typos Co-Authored-By: RalfJung <post@ralfj.de>
2019-04-07implement by-value object safetyRalf Jung-2/+9
2019-04-05Introduce an arena type which may be used to allocate a list of types with ↵John Kåre Alsaker-2/+1
destructors
2019-03-26renames EvalContext to InterpretCx.kenta7777-2/+2
2019-02-13make OpTy.op private, and ImmTy.imm public insteadRalf Jung-0/+4
2019-02-10rustc: doc commentsAlexander Regueiro-1/+1