about summary refs log tree commit diff
path: root/src/librustc_mir/const_eval
AgeCommit message (Collapse)AuthorLines
2020-02-23miri/machine: add canonical_alloc_id hook to replace find_foreign_staticRalf Jung-9/+1
2020-02-22Auto merge of #69374 - Dylan-DPC:rollup-x7mjd5z, r=Dylan-DPCbors-0/+87
Rollup of 7 pull requests Successful merges: - #68984 (Make `u8::is_ascii` a stable `const fn`) - #69339 (Add test for #69312) - #69346 (Clean up E0323, E0324, E0325 and E0326 explanations) - #69348 (Wrong error message for move_ref_pattern) - #69349 (MIR is not an experiment anymore) - #69354 (Test `Duration::new` panics on overflow) - #69370 (move const_eval.rs into the module folder) Failed merges: r? @ghost
2020-02-22move const_eval.rs into the module folderRalf Jung-0/+87
2020-02-20Revert "Rollup merge of #69280 - ↵Dylan MacKenzie-2/+2
ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov" This reverts commit 61d3b6dedb1ec1f3e3cbd3d66b1a3453225bc37c, reversing changes made to c6ad1e2c2a0c7e48537617d36085f866fa6a65a3.
2020-02-20Auto merge of #68847 - ecstatic-morse:const-impl, r=oli-obkbors-53/+77
Allow trait methods to be called on concrete types in a const context This partially implements [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) by const-checking methods inside an `impl const` block and allowing those methods to be called on concrete types. Calling trait methods on type parameters in a const context is not yet allowed. Implementing this will require much more work. Since we are only concerned with methods on concrete types, we are able to take advantage of the machinery in `Instance::resolve`, which is doing most of the work. This also propagates `#[rustc_const_unstable]` from parent items to child items, making that attribute behave like `#[stable]` and `#[unstable]` do. This allows trait methods to be marked as unstably const. cc #67792 #57563 cc @rust-lang/wg-const-eval r? @oli-obk
2020-02-18Remove mention of `simd_shuffle` promotion from commentsDylan MacKenzie-2/+2
2020-02-18Make `fn_queries` helpers module-privateDylan MacKenzie-75/+74
2020-02-18Remove outdated FIXMEDylan MacKenzie-2/+0
2020-02-18Const-check functions in a `const` implDylan MacKenzie-1/+14
2020-02-18Add `is_const_impl_raw` queryDylan MacKenzie-1/+15
2020-02-18Rollup merge of #69181 - skinny121:const-eval-return, r=oli-obkDylan DPC-11/+7
Change const eval to just return the value As discussed in https://github.com/rust-lang/rust/pull/68505#discussion_r370956535, the type of consts shouldn't be returned from const eval queries. r? @eddyb cc @nikomatsakis
2020-02-15Change const eval to return `ConstValue`, instead of `Const` as the type ↵Ben Lewis-11/+7
inside it shouldn't be used.
2020-02-14Check `has_typeck_tables` before calling `typeck_tables_of`Yuki Okushi-1/+4
2020-02-13rename PanicInfo -> AssertKindRalf Jung-4/+4
2020-02-13move PanicInfo to mir moduleRalf Jung-4/+6
2020-02-13no need for hook_panic_fn to return a boolRalf Jung-10/+8
2020-02-13remove PanicInfo::Panic variant that MIR does not use or needRalf Jung-6/+11
2020-02-13remove Panic variant from InterpErrorRalf Jung-24/+59
2020-02-11Run RustFmtjumbatm-3/+1
2020-02-11Invert control in struct_lint_level.jumbatm-4/+5
Caller now passes in a `decorate` function, which is only run if the lint is allowed.
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-1/+1
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-01-28Auto merge of #68587 - JohnTitor:rollup-fz45xwc, r=JohnTitorbors-0/+4
Rollup of 11 pull requests Successful merges: - #68200 (Stabilize the debug_map_key_value feature) - #68383 (Clean up E0205 explanation) - #68412 (Clean up E0207 explanation) - #68454 (clean up E0214 explanation) - #68482 (clean up error codes explanation) - #68563 (Don't call `tcx.fn_sig` on closures) - #68570 (Bump LLVM submodule to fix LLVM assertion failure in MSP430 interrupt generation.) - #68571 (check_match: extract common logic) - #68573 (Clean up E0262 explanation) - #68575 (Disable the testcase for Vxworks.) - #68581 (Add support for icebreakers-cleanup-crew commands) Failed merges: r? @ghost
2020-01-27Don't call `tcx.fn_sig` on closuresAaron Hill-0/+4
Fixes #68542
2020-01-27don't clone types that are copy, round two.Matthias Krüger-2/+2
2020-01-15Promoteds can contain raw pointers, but these must still only point to ↵Oliver Scherer-4/+9
immutable allocations
2020-01-10Promote `Ref`s to constants instead of staticSantiago Pastorino-4/+14
2020-01-10Rollup merge of #67501 - oli-obk:test-slice-patterns, r=RalfJungMazdak Farrokhzad-15/+18
Reduce special treatment for zsts addresses https://github.com/rust-lang/rust/pull/67467#discussion_r360650846 cc @RalfJung
2020-01-09Switch assertion order to be more helpful to ppl that encounter themOliver Scherer-1/+1
2020-01-08Move `is_min_const_fn` query to librustc_mir.Camille GILLOT-72/+67
The only two uses of the associated methods are in librustc_mir and librustdoc. Please tell me if there is a better choice.
2020-01-08Move constness.rs to librustc_mir.Camille GILLOT-0/+156
2020-01-07Add more documentationOliver Scherer-1/+6
2020-01-07Ensure we don't accidentally turn non-zsts into zstsOliver Scherer-0/+1
2020-01-07Move `to_const_value` from `MPlaceTy` to its only use siteOliver Scherer-2/+13
2020-01-07Fix an ICE happening due code assuming that `MPlaceTy` cannot have integer ↵Oliver Scherer-16/+2
addresses
2020-01-07Automatically prefer integer addresses for zst MPlaceOliver Scherer-2/+2
2020-01-06Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisabors-2/+2
Nix `rustc_hir` reexports in rustc::hir r? @Zoxc cc @Mark-Simulacrum
2020-01-05Fix ICE involving calling `Instance.ty` during const evaluationAaron Hill-1/+1
Fixes #67639 `Instance.ty` assumes that we are in a fully monomorphic context (e.g. codegen), and can therefore use an empty `ParamEnv` when performing normalization. Howver, the MIR constant evaluator code ends up calling `Instance.ty` as a result of us attemptign to 'speculatively' const-evaluate generic functions during const propagation. As a result, we may end up with projections involving type parameters (e.g. <T as MyTrait>::Bar>) in the type we are trying to normalize. Normalization expects us to have proper predicates in the `ParamEnv` for such projections, and will ICE if we don't. This commit adds a new method `Instance.ty_env`, which takes a `ParamEnv` for use during normalization. The MIR const-evaluator code is changed to use this method, passing in the proper `ParamEnv` for the context at hand.
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-2/+2
2020-01-04Rollup merge of #67137 - anp:tracked-panic-internals, r=eddybDylan DPC-1/+2
libstd uses `core::panic::Location` where possible. cc @eddyb
2020-01-04Update ABI in const impls of panic_fn/begin_panic_fn.Adam Perry-1/+2
2020-01-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-2/+2
2019-12-27Fix `Instance::resolve()` incorrectly returning specialized instancesWesley Wiser-9/+13
We only want to return specializations when `Reveal::All` is passed, not when `Reveal::UserFacing` is. Resolving this fixes several issues with the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization passes. Fixes #66901
2019-12-26Retire `to_ptr` which should already have no users but still kept getting ↵Oliver Scherer-3/+3
new ones
2019-12-26Rebase falloutOliver Scherer-3/+3
2019-12-26Bail out before running the queryOliver Scherer-3/+4
2019-12-26TidyOliver Scherer-7/+10
2019-12-26Fix imports after rebaseOliver Scherer-11/+9
2019-12-26Rename `query` moduleOliver Scherer-0/+0
2019-12-26Move function definitions before their first useOliver Scherer-138/+138
2019-12-26Move all functions used by the queries to query.rsOliver Scherer-0/+95