summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-01-27Make pointers to statics internalMatthew Jasper-22/+24
2020-01-13Fix rebase damageJonas Schievink-1/+0
2020-01-13Use the correct type for static qualifsMatthew Jasper-8/+8
2019-12-16Rollup merge of #66570 - lzutao:stabilize-result-map_or, r=Dylan-DPCMazdak Farrokhzad-1/+1
stabilize Result::map_or r? @SimonSapin Closes #66293
2019-12-13Correctly mark things as `min_const_fn`Dylan MacKenzie-4/+6
2019-12-13Put MIR checks for loops behind the feature flagDylan MacKenzie-1/+7
2019-12-12Require `allow_internal_unstable` for stable min_const_fn using unstable ↵Oliver Scherer-5/+5
features
2019-12-11Auto merge of #66650 - matthewjasper:nonuniform-array-move, r=pnkfelixbors-390/+5
Remove uniform array move MIR passes This PR fixes a number of bugs caused by limitations of this pass * Projections from constant indexes weren't being canonicalized * Constant indexes from the start weren't being canonicalized (they could have different min_lengths) * It didn't apply to non-moves This PR makes the following changes to support removing this pass: * ConstantIndex of arrays are now generated in a canonical form (from the start, min_length is the actual length). * Subslices are now split when generating move paths and when checking subslices have been moved. Additionally * The parent move path of a projection from an array element is now calculated correctly closes #66502
2019-12-11Rollup merge of #67015 - osa1:issue66971, r=wesleywiserMazdak Farrokhzad-11/+37
Fix constant propagation for scalar pairs We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later. Fixes #66971 Fixes #66339 Fixes #67019
2019-12-11Rollup merge of #67134 - oli-obk:const_prop_zst, r=wesleywiserYuki Okushi-4/+9
Ensure that we get a hard error on generic ZST constants if their bod… …y causes an error during evaluation cc #67083 (does not fix because we still need the beta backport) r? @wesleywiser cc @RalfJung
2019-12-09Remove `uniform_array_move_out` passesMatthew Jasper-386/+2
These passes were buggy, MIR building is now responsible for canonicalizing `ConstantIndex` projections and `MoveData` is responsible for splitting `Subslice` projections.
2019-12-09Make const index and subslice array projections more usefulMatthew Jasper-4/+3
* `min_length` is now exact for const index elements. * const index elements are always from the start. * make array `Subslice` `PlaceElems` count both `from` and `to` from the start.
2019-12-08Rollup merge of #66991 - Nashenas88:body_cache_cleanup, r=eddybMazdak Farrokhzad-87/+87
Cleanup BodyCache After this PR: - `BodyCache` is renamed to `BodyAndCache` - `ReadOnlyBodyCache` is renamed to `ReadOnlyBodyAndCache` - `ReadOnlyBodyAndCache::body` fn is removed and all calls to it are replaced by a deref (possible due to fix of its `Deref` imp in #65947) cc @eddyb @oli-obk
2019-12-08Ensure that we get a hard error on generic ZST constants if their body ↵Oliver Scherer-4/+9
causes an error during evaluation
2019-12-07Auto merge of #65881 - anp:implicit-caller-location, r=eddyb,oli-obkbors-0/+5
Implement #[track_caller] attribute. (RFC 2091 4/N) Implements the `#[track_caller]` attribute in both const and codegen contexts. The const implementation walks up the stack to find the nearest untracked callsite. The codegen implementation adds an implicit argument to tracked function calls, and populates it with either a call to the previously-landed intrinsic or if the caller has `#[track_caller]` with a copy of the location passed to the current function. Also includes a little cleanup and a few comments in the other caller location areas. [Depends on: 65664](https://github.com/rust-lang/rust/pull/65664) [RFC 2091 text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md) [Tracking issue](https://github.com/rust-lang/rust/issues/47809) [Tracking doc](https://paper.dropbox.com/doc/track_rfc_2091_impl-notes--Anf1NwnIb0xcRv31YLIadyj0Ag-rwCdRc2fi2yvRZ7syGZ9q#:uid=863513134494965680023183&h2=TODO-actually-pass-location-to)
2019-12-06Rollup merge of #66606 - christianpoveda:mut-refs-in-const-fn, r=oli-obkMazdak Farrokhzad-32/+57
Add feature gate for mut refs in const fn r? @oli-obk
2019-12-06const-prop: Restrict scalar pair propagationÖmer Sinan Ağacan-11/+37
We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later. Fixes #66971 Fixes #66339 Fixes #67019
2019-12-06Fix rebase issuesvarkor-2/+2
2019-12-06Rename to `then_some` and `then`varkor-1/+1
2019-12-06Use `to_option` in various placesvarkor-1/+1
2019-12-05`#[track_caller]` suppresses MIR inlining.Adam Perry-0/+5
2019-12-05rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded ↵Paul Daniel Faria-87/+87
Index impl, remove body fn rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-05update comment to explain the importance of this check more clearlyRemy Rakic-2/+3
2019-12-05make const-qualif look at more `const fn`sRemy Rakic-1/+5
the unstables ones in libcore, with the unstable feature disabled, were not checked
2019-12-04Auto merge of #66866 - oli-obk:const_fn_memoization, r=RalfJungbors-1/+1
Only memoize const fn calls during const eval Miri and other engines may want to execute the function in order to detect UB inside of them. r? @RalfJung
2019-12-04Auto merge of #66275 - oli-obk:organize-intrinsics-promotion-checks, r=RalfJungbors-88/+4
Organize intrinsics promotion checks cc @vertexclique supersedes #61835 r? @RalfJung
2019-12-03rustc: expose the mir::Body reference lifetime from mir::ReadOnlyBodyCache ↵Eduard-Mihai Burtescu-21/+21
(#64736 fallout).
2019-12-03TidyOliver Scherer-1/+0
2019-12-03Move all intrinsic whitelists into the constness check fileOliver Scherer-52/+3
2019-12-03Only check `min_const_fn` for const fnsOliver Scherer-1/+1
2019-12-03Check intrinsics for callability in const fnsMahmut Bulut-55/+21
2019-12-02Auto merge of #64736 - Nashenas88:mir_predecessors_cache_cleanup, r=oli-obkbors-171/+242
Remove interior mutability in mir predecessors cache
2019-12-02Suggest feature for const_mut_refs errorsChristian Poveda-3/+7
2019-12-02Fix issues caused during rebasingPaul Daniel Faria-2/+1
2019-12-02Disallow cell borrowingChristian Poveda-27/+36
2019-12-02Allow mutable derefs with feature gateChristian Poveda-1/+5
2019-12-02Allow mutable borrows in constant bodiesChristian Poveda-0/+4
2019-12-02Rename feature gateChristian Poveda-1/+1
2019-12-02Allow &mut in const fns when feature gate is enabledChristian Poveda-4/+8
2019-12-02Fix issues caused during rebasingPaul Daniel Faria-1/+1
2019-12-02Fix tidy issuesPaul Daniel Faria-1/+2
2019-12-02Fix rebasing errors, convert some BodyCache::body() calls to reborrowsPaul Daniel Faria-23/+24
2019-12-02Fix type errors created during rebasingPaul Daniel Faria-38/+42
2019-12-02Fix type errors cause during rebasingPaul Daniel Faria-4/+5
2019-12-02Compute predecessors in mir_build query and use existing cache for ↵Paul Daniel Faria-3/+4
generating ReadOnlyBodyCache, remove unneeded fns
2019-12-02Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, ↵Paul Daniel Faria-331/+331
rename all body_cache back to body
2019-12-02Remove BodyCache.body and rely on Deref as much as possible for ↵Paul Daniel Faria-14/+14
ReadOnlyBodyCache
2019-12-02Fix typoPaul Daniel Faria-1/+1
2019-12-02Fix tidy errorsPaul Daniel Faria-27/+74
2019-12-02Fix typos caused during rebasePaul Daniel Faria-3/+3