about summary refs log tree commit diff
path: root/src/librustc_mir/const_eval
AgeCommit message (Collapse)AuthorLines
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
2020-03-30remove a dead parameter that everyone sets to NoneRalf Jung-1/+1
2020-03-30stop unnecessarily passing around span argument for Miri function callsRalf Jung-7/+4
2020-03-30remove caller span from Miri stack frameRalf Jung-1/+0
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-4/+4
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-19/+19
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-1/+1
2020-03-29Use `&` to do deref coercion for `ReadOnlyBodyAndCache`Dylan MacKenzie-1/+1
2020-03-26Rollup merge of #70385 - RalfJung:miri-nits, r=eddybMazdak Farrokhzad-4/+4
Miri nits: comment and var name improvement r? @eddyb
2020-03-25miri: avoid a bunch of casts by offering usized-based field indexingRalf Jung-4/+7
2020-03-25rename def_id -> static_def_idRalf Jung-3/+3
2020-03-25better explain GLOBAL_KIND choiceRalf Jung-1/+1
2020-03-24fix const_prop ICERalf Jung-5/+4
2020-03-24get back the more precise error messageRalf Jung-2/+6
2020-03-24move ModifiedStatic error to ConstEval errors, and generally adjust ↵Ralf Jung-6/+16
terminology from "static" to "global" where appropriate
2020-03-24Rollup merge of #70087 - ecstatic-morse:remove-const-eval-loop-detector, ↵Mazdak Farrokhzad-47/+20
r=RalfJung Remove const eval loop detector Now that there is a configurable instruction limit for CTFE (see #67260), we can replace the loop detector with something much simpler. See #66946 for more discussion about this. Although the instruction limit is nightly-only, the only practical way to reach the default limit uses nightly-only features as well (although CTFE will still execute code using such features inside an array initializer on stable). This will at the very least require a crater run, since it will result in an error wherever the "long running const eval" warning appeared before. We may need to increase the default for `const_eval_limit` to work around this. Resolves #54384 cc #49980 r? @oli-obk cc @RalfJung
2020-03-23add err_machine_stop macroRalf Jung-2/+2
2020-03-22Rename `TimeLimitReached` -> `StepLimitReached`Dylan MacKenzie-1/+1
2020-03-21remove unused unit values (clippy::unused_unit)Matthias Krüger-3/+1
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-1/+1
2020-03-19rustc: rename DefId::to_local to expect_local and use it instead of ↵Eduard-Mihai Burtescu-2/+2
LocalDefId::from_def_id.
2020-03-18Rollup merge of #69839 - RalfJung:miri-error-cleanup, r=oli-obkMazdak Farrokhzad-1/+2
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-17Use `const_eval_limit` instead of infinite loop detectorDylan MacKenzie-47/+20
2020-03-12remove lifetimes that can be elided (clippy::needless_lifetimes)Matthias Krüger-1/+1
2020-03-11miri: categorize errors into "unsupported" and "UB"Ralf Jung-1/+2
Also slightly refactor pointer bounds checks to avoid creating unnecessary temporary Errors
2020-03-11Rollup merge of #69850 - RalfJung:panic-bounds-check, r=eddybMazdak Farrokhzad-1/+0
panic_bounds_check: use caller_location, like PanicFnLangItem The `PanicFnLangItem` got switched to using `#[caller_location]` at some point, but `PanicBoundsCheckFnLangItem` was kept in the old style. For consistency, switch that one over to use `#[caller_location]` as well. This is also helpful for Miri as it means the `assert_panic` machine hook never needs to know the current `Span`.
2020-03-09remove no-longer needed span from Miri Machine hookRalf Jung-1/+0
2020-03-08fix some cases of unexpected exceptions leaving validationRalf Jung-1/+6
2020-03-06fix various typosMatthias Krüger-2/+2
2020-03-05Opt out of CTFE if the 'const_eval_limit' is set to 0Christoph Schmidler-7/+15
2020-03-01Auto merge of #69408 - RalfJung:canonical-alloc-id, r=oli-obkbors-9/+1
Miri: let machine canonicalize AllocIDs This implements the rustc side of the plan I laid out [here](https://github.com/rust-lang/miri/pull/1147#issuecomment-581868901). Miri PR: https://github.com/rust-lang/miri/pull/1190
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-1/+1
example: let s: String = format!("hello").into();