about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2020-05-17Auto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiserbors-1/+24
Propagate locals, even if they have unpropagatable assignments somewhere Second try for https://github.com/rust-lang/rust/pull/71946#discussion_r422967292 r? @wesleywiser cc @rust-lang/wg-mir-opt @RalfJung
2020-05-17add docsBastian Kauschke-0/+2
2020-05-17Assume unevaluated consts are equal to the other consts and add ConstEquate ↵Ben Lewis-2/+5
obligation. This delays the need to evaluate consts eagerly and therefore gets around const eval query cycles.
2020-05-16Name return place in debuginfo if it is a user variableDylan MacKenzie-0/+4
2020-05-16Expand comment with possible improvementsDylan MacKenzie-2/+6
2020-05-16Dumb NRVODylan MacKenzie-0/+221
2020-05-16Improve documentation for drop elaborationJonas Schievink-9/+99
2020-05-16move borrow-of-packed-field unsafety check out of loopRalf Jung-19/+19
2020-05-16Rollup merge of #72216 - doctorn:require-lang-item, r=lcnrDylan DPC-1/+3
Remove `lang_items\(\).*\.unwrap\(\)` Follows up #72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`). Resolves #72195
2020-05-16Auto merge of #71665 - RalfJung:miri-intern-no-ice, r=oli-obkbors-157/+183
Miri interning: replace ICEs by proper errors Fixes https://github.com/rust-lang/rust/issues/71316 I also did some refactoring, as I kept being confused by all the parameters to `intern_shallow`, some of which have invalid combinations (such as a mutable const). So instead `InternMode` now contains all the information that is needed and invalid combinations are ruled out by the type system. Also I removed interpreter errors from interning. We already ignored almost all errors, and the `ValidationFailure` errors that we handled separately actually cannot ever happen here. The only interpreter failure that was actually reachable was the UB on dangling pointers -- and arguably, a dangling raw pointer is not UB, so the error was not even correct. It's just that the rest of the compiler does not like "dangling" `AllocId`. It should be possible to review the 3 commits separately. r? @oli-obk Cc @rust-lang/wg-const-eval
2020-05-16Rollup merge of #72220 - wesleywiser:const_prop_eval_consts, r=oli-obkDylan DPC-0/+7
[const-prop] Don't replace Rvalues that are already constants This cleans up a few mir-opt tests which have slight changes to spans for `consts` as a result of replacing them with new Rvalues.
2020-05-15InvalidUninitBytes: Track more info about accessDavid Cook-6/+8
2020-05-15Remove lang_items\(\).*\.unwrap\(\)Nathan Corbyn-1/+3
2020-05-14[const-prop] Don't replace Rvalues that are already constantsWesley Wiser-0/+7
2020-05-14Rollup merge of #72170 - lcnr:lang_item, r=oli-obkDylan DPC-16/+22
use `require_lang_item` over `unwrap`. Does not yet replace all uses of `lang_items\(\)\.*\.unwrap\(\)`, as there are more than I expected :sweat_smile: Fixes #72099 r? @RalfJung *edit: The goal of this this PR is to change ICE from missing lang items to a fatal error.*
2020-05-14Auto merge of #72187 - RalfJung:rollup-a7a9jdi, r=RalfJungbors-2/+0
Rollup of 12 pull requests Successful merges: - #71525 (`prefix` should not be mutable.) - #71741 (Pointer printing: do not print 0 offset) - #71870 (Be slightly more precise about any::type_name()'s guarantees.) - #71909 (Document From trait for Option implementations) - #71964 (Fix bootstrap failing on win32) - #72137 (Clean up E0581 explanation) - #72138 (Add doc comment for `rustc_middle::mir::mono::Linkage`) - #72150 (Remove UnnormalizedProjection) - #72151 (Update books) - #72163 (docs: remove comment referencing non-existent method) - #72169 (Clean up E0582 explanation) - #72183 (Fix Arc::decr_strong_count doc test) Failed merges: r? @ghost
2020-05-14Rollup merge of #72150 - jackh726:unnorm_projection, r=nikomatsakisRalf Jung-2/+0
Remove UnnormalizedProjection This was only used for the old chalk integration with chalk-engine r? @nikomatsakis
2020-05-14Auto merge of #69756 - wesleywiser:simplify_try, r=oli-obkbors-41/+315
Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1 I also added test cases to make sure the optimization can fire on all of these cases: ```rust fn case_1(o: Option<u8>) -> Option<u8> { match o { Some(u) => Some(u), None => None, } } fn case2(r: Result<u8, i32>) -> Result<u8, i32> { match r { Ok(u) => Ok(u), Err(i) => Err(i), } } fn case3(r: Result<u8, i32>) -> Result<u8, i32> { let u = r?; Ok(u) } ``` Without MIR inlining, this still does not completely optimize away the `?` operator because the `Try::into_result()`, `From::from()` and `Try::from_error()` calls still exist. This does move us a bit closer to that goal though because: - We can now run the pass on mir-opt-level=1 - We no longer depend on the copy propagation pass running which is unlikely to stabilize anytime soon. Fixes #66855
2020-05-13add spans to `require_lang_items`Bastian Kauschke-7/+12
2020-05-13use `require_lang_item` over `unwrap`.Bastian Kauschke-16/+17
2020-05-12Add some more sanity tests and add a debug log message for itOliver Scherer-0/+5
2020-05-12Propagate locals, even if they have unpropagatable assignments somewhere.Oliver Scherer-1/+19
2020-05-12Rollup merge of #72128 - RalfJung:str-validity, r=oli-obkDylan DPC-3/+4
strings do not have to be valid UTF-8 any more Cc https://github.com/rust-lang/reference/pull/792 r? @oli-obk
2020-05-12Rollup merge of #72096 - jonas-schievink:mirck-docs, r=matthewjasperDylan DPC-54/+50
Make MIR typeck use `LocalDefId` and fix docs The docs on `fn type_check` were not in sync with the arguments it takes. r? @matthewjasper
2020-05-12Rollup merge of #72048 - jonas-schievink:visit-return, r=oli-obkDylan DPC-2/+21
Visit move out of `_0` when visiting `return` Closes https://github.com/rust-lang/rust/issues/72032
2020-05-12strings do not have to be valid UTF-8 any moreRalf Jung-3/+4
2020-05-12Remove ty::UnnormalizedProjectionJack Huey-2/+0
2020-05-11Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1Wesley Wiser-41/+315
I also added test cases to make sure the optimization can fire on all of these cases: ```rust fn case_1(o: Option<u8>) -> Option<u8> { match o { Some(u) => Some(u), None => None, } } fn case2(r: Result<u8, i32>) -> Result<u8, i32> { match r { Ok(u) => Ok(u), Err(i) => Err(i), } } fn case3(r: Result<u8, i32>) -> Result<u8, i32> { let u = r?; Ok(u) } ``` Without MIR inlining, this still does not completely optimize away the `?` operator because the `Try::into_result()`, `From::from()` and `Try::from_error()` calls still exist. This does move us a bit closer to that goal though because: - We can now run the pass on mir-opt-level=1 - We no longer depend on the copy propagation pass running which is unlikely to stabilize anytime soon.
2020-05-11Rollup merge of #72044 - RalfJung:min-spec, r=matthewjasperDylan DPC-1/+1
use min_specialization for some rustc crates where it requires no changes and add FIXME for the rest Cc @matthewjasper
2020-05-11borrowck `DefId` -> `LocalDefId`Bastian Kauschke-67/+59
2020-05-11Auto merge of #71953 - oli-obk:const_prop_deaggregates, r=wesleywiserbors-42/+58
Const prop aggregates even if partially or fully modified r? @wesleywiser cc @rust-lang/wg-mir-opt I'm moderately scared of this change, but I'm confident in having reviewed all the cases.
2020-05-11Make MIR typeck use `LocalDefId` and fix docsJonas Schievink-54/+50
2020-05-10TypoRalf Jung-1/+1
Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-05-10fmtRalf Jung-27/+16
2020-05-10avoid raising interpreter errors from interningRalf Jung-19/+27
2020-05-10remove some dead code, and assert we do not swallow allocating errorsRalf Jung-18/+19
2020-05-10Miri interning: replace ICEs by proper errors, make intern_shallow type ↵Ralf Jung-119/+147
signature more precise
2020-05-10Rollup merge of #71840 - matthewjasper:drop-trees, r=oli-obkRalf Jung-44/+26
Rework MIR drop tree lowering This PR changes how drops are generated in MIR construction. This is the first half of the fix for #47949. Rather than generating the drops for a given unwind/break/continue/return/generator drop path as soon as they are needed, the required drops are recorded and get generated later. The motivation for this is * It simplifies the caching scheme, because it's now possible to walk up the currently scheduled drop tree to recover state. * The basic block order for MIR more closely resembles execution order. This PR also: * Highlights cleanup blocks in the graphviz MIR output. * Removes some unnecessary drop flag assignments.
2020-05-10use min_specialization for some rustc crates where it requires no changesRalf Jung-1/+1
2020-05-09Visit move out of `_0` when visiting `return`Jonas Schievink-2/+21
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-7/+5
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-09Rollup merge of #71508 - oli-obk:alloc_map_unlock, r=RalfJungRalf Jung-30/+25
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-09Address review commentsMatthew Jasper-2/+6
2020-05-09Reduce the number of drop-flag assignments in unwind pathsMatthew Jasper-39/+12
2020-05-09Defer creating drop trees in MIR lowering until leaving that scopeMatthew Jasper-3/+8
2020-05-09Auto merge of #72036 - Dylan-DPC:rollup-ca8b0ql, r=Dylan-DPCbors-141/+109
Rollup of 8 pull requests Successful merges: - #70834 (Add core::future::{pending,ready}) - #71839 (Make BTreeMap::new and BTreeSet::new const) - #71890 (Simplify the error Registry methods a little) - #71942 (Shrink `LocalDecl`) - #71947 (Dead-code pass highlights too much of impl functions) - #71981 (Fix `strip-priv-imports` pass name in the rustdoc documentation) - #72018 (Fix canonicalization links) - #72031 (Better documentation for io::Read::read() return value) Failed merges: r? @ghost
2020-05-09Support coercion between (FnDef | Closure) and (FnDef | Closure) when ↵Donough Liu-1/+1
Closure is non-capturing
2020-05-09Rollup merge of #71942 - nnethercote:shrink-LocalDecl, r=matthewjasperDylan DPC-141/+109
Shrink `LocalDecl` `LocalDecl` contributes 4-8% of peak heap memory usage on a range of benchmarks. This PR reduces its size from 128 bytes to 56 bytes on 64-bit, and does some clean-ups as well. r? @matthewjasper
2020-05-08Auto merge of #71418 - hbina:rename_miri_undef, r=RalfJungbors-43/+43
Renamed "undef" -> "uninit" 1. InvalidUndefBytes -> InvalidUninitBytes 2. ScalarMaybeUndef -> ScalarMaybeUninit 3. UndefMask -> InitMask Related issue #71193
2020-05-08Rollup merge of #71993 - ecstatic-morse:cleanup-old-liveness, r=jonas-schievinkDylan DPC-334/+92
Remove old `util/liveness.rs` module The liveness dataflow analysis now lives in the `dataflow` module, so this one is no longer necessary. I've copied the relevant bits of the module docs for `util::liveness` to `MaybeLiveLocals`. The example in the docs is now a `mir-dataflow` test: https://github.com/rust-lang/rust/blob/a08c47310c7d49cbdc5d7afb38408ba519967ecd/src/test/ui/mir-dataflow/liveness-ptr.rs#L6-L26 The borrow-checker used the same notion of "defs" and "uses", so I've moved it into a submodule. I would have moved it to `util/def_use.rs`, since it seems generally useful, but there's already a slightly [different version](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/util/def_use.rs) of the same abstraction needed for copy propagation.