summary refs log tree commit diff
path: root/src/librustc_mir/const_eval
AgeCommit message (Collapse)AuthorLines
2020-07-10Avoid "whitelist"Tamir Duberstein-1/+1
Other terms are more inclusive and precise.
2020-07-09Rollup merge of #74070 - eddyb:forall-tcx-providers, r=nikomatsakisManish Goregaokar-1/+1
Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>. In order to work around normalization-under-HRTB (for `provide!` in `rustc_metadata`), we ended up with this: ```rust struct Providers<'tcx> { type_of: fn(TyCtxt<'tcx>, DefId) -> Ty<'tcx>, // ... } ``` But what I initially wanted to do, IIRC, was this: ```rust struct Providers { type_of: for<'tcx> fn(TyCtxt<'tcx>, DefId) -> Ty<'tcx>, // ... } ``` This PR moves to the latter, for the simple reason that only the latter allows keeping a `Providers` value, or a subset of its `fn` pointer fields, around in a `static` or `thread_local!`, which can be really useful for custom drivers that override queries. (@jyn514 and I came across a concrete usecase of that in `rustdoc`) The `provide!` macro in `rustc_metadata` is fixed by making the query key/value types available as type aliases under `ty::query::query_{keys,values}`, not just associated types (this is the first commit). r? @nikomatsakis
2020-07-06Auto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercotebors-5/+5
Shrink ParamEnv to 16 bytes r? @nnethercote x.py check passes but I haven't tried running perf or tests
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-1/+1
2020-07-05Shrink ParamEnv to 16 bytesMark Rousskov-5/+5
2020-07-04ConstCx to LocalDefIdBastian Kauschke-4/+4
2020-06-26Show the values and computation that would overflow a const evaluation or ↵Oliver Scherer-16/+11
propagation
2020-06-19pretty/mir: const value enums with no variantsDavid Wood-9/+15
This commit modifies the pretty printer and const eval in the MIR so that `destructure_const` (used in `pretty_print_const_value`) can handle enums with no variants (or types containing enums with no variants). Signed-off-by: David Wood <david@davidtw.co>
2020-06-14keep root_span and tcx togetherRalf Jung-2/+2
2020-06-12avoid computing cur_span all the timeRalf Jung-3/+9
2020-06-12fix const_prop spans and re-bless testsRalf Jung-4/+5
2020-06-12make miri InterpCx TyCtxtAt a TyCtxt, and separately remember the root span ↵Ralf Jung-11/+12
of the evaluation
2020-06-09Fix more clippy warningsMatthias Krüger-3/+1
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-05-28standardize limit comparisons with `Limit` typeDavid Wood-2/+3
This commit introduces a `Limit` type which is used to ensure that all comparisons against limits within the compiler are consistent (which can result in ICEs if they aren't). Signed-off-by: David Wood <david@davidtw.co>
2020-05-24Removed all instances of const_field.Rakshith Ravi-28/+1
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-2/+2
2020-05-10avoid raising interpreter errors from interningRalf Jung-2/+2
2020-05-09Rollup merge of #71508 - oli-obk:alloc_map_unlock, r=RalfJungRalf Jung-3/+3
Simplify the `tcx.alloc_map` API This PR changes all functions that require manually locking the `alloc_map` to functions on `TyCtxt` that lock the map internally. In the same step we make the `TyCtxt::alloc_map` field private. r? @RalfJung
2020-05-08Create a convenience wrapper for `get_global_alloc(id).unwrap()`Oliver Scherer-6/+5
2020-05-08Move `unwrap_fn` and `unwrap_memory` to `GlobalAlloc`Oliver Scherer-3/+9
2020-05-08Simplify the `tcx.alloc_map` APIOliver Scherer-8/+3
2020-05-07Renamed "undef" stuff to "uninit"Hanif Bin Ariffin-5/+5
1. InvalidUndefBytes -> InvalidUninitBytes 2. ScalarMaybeUndef -> ScalarMaybeUninit 3. UndefMask -> InitMask Related issue #71193
2020-05-02Rollup merge of #71712 - RalfJung:error-backtrace, r=oli-obkRalf Jung-1/+1
Miri: port error backtraces to std::backtrace No need to pull in an external dependency if libstd already includes this feature (using the same dependency internally, but... still). r? @oli-obk
2020-04-30Miri: port error backtraces to std::backtraceRalf Jung-1/+1
2020-04-28clarify commentRalf Jung-1/+3
2020-04-28better document const-pattern dynamic soundness checks, and fix a soundness holeRalf Jung-2/+9
2020-04-28Rollup merge of #71615 - RalfJung:share-machine-code, r=oli-obkDylan DPC-56/+4
share some common code for compile-time miri instances Fixes https://github.com/rust-lang/rust/issues/71129 r? @oli-obk
2020-04-27Use `LocalDefId` in `typeck_tables_of` and `used_trait_imports` queriesmarmeladema-3/+5
2020-04-27share some common code for compile-time miri instancesRalf Jung-56/+4
2020-04-24Remove `Option` from the return type of `def_kind`.Eduard-Mihai Burtescu-1/+1
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-3/+3
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-4/+3
2020-04-22Don't use `*` for deref-coercionDylan MacKenzie-1/+1
2020-04-19Auto merge of #70598 - vakaras:add-threads-cr3, r=oli-obk,RalfJungbors-7/+25
Make the necessary changes to support concurrency in Miri. This pull request makes the necessary changes to the Rust compiler to allow Miri to support concurrency: 1. Move stack from the interpretation context (`InterpCx`) to machine, so that the machine can switch the stacks when it changes the thread being executed. 2. Add the callbacks that allow the machine to generate fresh allocation ids for each thread local allocation and to translate them back to original allocations when needed. This allows the machine to ensure the property that allocation ids are unique, which allows using a simpler representation of the memory. r? @oli-obk cc @RalfJung
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-1/+1
2020-04-17Rollup merge of #69642 - ecstatic-morse:issue-69615, r=oli-obkDylan DPC-17/+10
Use query to determine whether function needs const checking Resolves #69615. The HIR const-checker was checking the `constness` of a function's `fn_sig` to determine whether a function needed const-checking. Now that const trait impls are a thing, this is no longer enough. All code should use the `is_const_fn_raw` query instead, which takes the constness of the impl block into account. r? @oli-obk
2020-04-16Move stack access methods in the Machine implementations out of the enforce_ ↵Vytautas Astrauskas-14/+14
method group.
2020-04-16mir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.Eduard-Mihai Burtescu-10/+6
2020-04-15Make the necessary changes to support concurrency in Miri.Vytautas Astrauskas-7/+25
2020-04-15Rollup merge of #71100 - RalfJung:miri-frame-hook, r=oli-obkMazdak Farrokhzad-23/+29
Miri: expand frame hooks This is needed to make https://github.com/rust-lang/miri/pull/1330 work. r? @oli-obk @eddyb
2020-04-14Rollup merge of #70947 - RalfJung:ctfe-no-read-mut-global, r=oli-obkDylan DPC-8/+23
tighten CTFE safety net for accesses to globals Previously, we only rejected reading from all statics. Now we also reject reading from any mutable global. Mutable globals are the true culprit here as their run-time value might be different from their compile-time values. Statics are just the approximation we use for that so far. Also refactor the code a bit to make it clearer what is being checked and allowed. r? @oli-obk
2020-04-13fmtRalf Jung-2/+3
2020-04-13Miri: let machine hook dynamically decide about alignment checksRalf Jung-3/+6
2020-04-13add after_stack_push hook; add public ImmTy::from_immediate method, and make ↵Ralf Jung-19/+21
ImmTy::imm field private
2020-04-13Miri: let push_frame hook also access and mutate the rest of the frame dataRalf Jung-4/+7
2020-04-10librustc_middle: return LocalDefId instead of DefId in get_parent_didmarmeladema-5/+1
2020-04-10assert that only statics can possibly be mutableRalf Jung-8/+8
2020-04-09Avoid calling `fn_sig` query during `is_const_fn_raw`Dylan MacKenzie-17/+10
2020-04-09tighten CTFE safety net for accesses to globalsRalf Jung-8/+23
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-4/+5