about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-03-27clarify hir_id <-> node_id method namesBastian Kauschke-1/+1
2020-03-27Auto merge of #68404 - Amanieu:llvm-asm, r=estebankbors-6/+6
Rename asm! to llvm_asm! As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850. This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
2020-03-26Update imports from `dataflow::generic` to `dataflow`Dylan MacKenzie-6/+6
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-6/+6
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26Rollup merge of #70385 - RalfJung:miri-nits, r=eddybMazdak Farrokhzad-3/+3
Miri nits: comment and var name improvement r? @eddyb
2020-03-26Rollup merge of #69866 - estebank:guess_head_span, r=eddybMazdak Farrokhzad-2/+2
Rename `def_span` to `guess_head_span` r? @eddyb
2020-03-25Rename `def_span` to `guess_head_span`Esteban Küber-2/+2
2020-03-25Rename LayoutDetails to just Layout.Ana-Maria Mihalache-2/+2
2020-03-25rename def_id -> static_def_idRalf Jung-2/+2
2020-03-25better explain GLOBAL_KIND choiceRalf Jung-1/+1
2020-03-24Rollup merge of #70241 - RalfJung:global-mem, r=oli-obkMazdak Farrokhzad-9/+18
Miri: move ModifiedStatic to ConstEval errors Also generally adjust terminology from "static" to "global" where appropriate (to avoid confusion with specifically `static` items).
2020-03-24actually we can reject all reads from mutable allocs in const-propRalf Jung-6/+5
2020-03-24fix const_prop ICERalf Jung-2/+6
2020-03-24get back the more precise error messageRalf Jung-0/+1
2020-03-24move ModifiedStatic error to ConstEval errors, and generally adjust ↵Ralf Jung-8/+13
terminology from "static" to "global" where appropriate
2020-03-24Rollup merge of #70259 - wesleywiser:use_reveal_all, r=eddybMazdak Farrokhzad-18/+4
Use Reveal::All in MIR optimizations Resolves some code review feedback in #67662. Fixes #68855 r? @eddyb
2020-03-24Rollup merge of #70267 - RalfJung:const-prop-unsup, r=oli-obk,wesleywiserMazdak Farrokhzad-9/+24
get rid of ConstPropUnsupported; use ZST marker structs instead This gets rid of yet another machine-specific error variant. r? @oli-obk
2020-03-23add macro to reduce boilerplate and keep readable messagesRalf Jung-21/+24
2020-03-23Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakisMazdak Farrokhzad-2/+2
rustc: keep upvars tupled in {Closure,Generator}Substs. Previously, each closure/generator capture's (aka "upvar") type was tracked as one "synthetic" type parameter in the closure/generator substs, and figuring out where the parent `fn`'s generics end and the synthetics start involved slicing at `tcx.generics_of(def_id).parent_count`. Needing to query `generics_of` limited @davidtwco (who wants to compute some `TypeFlags` differently for parent generics vs upvars, and `TyCtxt` is not available there), which is how I got started on this, but it's also possible that the `generics_of` queries are slowing down `{Closure,Generator}Substs` methods. To give an example, for a `foo::<T, U>::{closure#0}` with captures `x: X` and `y: Y`, substs are: * before this PR: `[T, U, /*kind*/, /*signature*/, X, Y]` * after this PR: `[T, U, /*kind*/, /*signature*/, (X, Y)]` You can see that, with this PR, no matter how many captures, the last 3 entries in the substs (or 5 for a generator) are always the "synthetic" ones, with the last one being the tuple of capture types. r? @nikomatsakis cc @Zoxc
2020-03-22miri engine: turn error sanity checks into assertionsRalf Jung-2/+1
2020-03-22Rollup merge of #70254 - matthiaskrgr:cl4ppy, r=CentrilDylan DPC-3/+2
couple more clippy fixes (let_and_return, if_same_then_else) * summarize if-else-code with identical blocks (clippy::if_same_then_else) * don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
2020-03-22get rid of ConstPropUnsupported; use ZST marker structs insteadRalf Jung-10/+22
2020-03-21Use Reveal::All in MIR inlinerWesley Wiser-10/+3
2020-03-21Resolve worsened debug build codegenWesley Wiser-8/+1
2020-03-22don't create variable bindings just to return the bound value immediately ↵Matthias Krüger-3/+2
(clippy::let_and_return)
2020-03-21remove unused unit values (clippy::unused_unit)Matthias Krüger-3/+1
2020-03-21rustc: keep upvars tupled in {Closure,Generator}Substs.Eduard-Mihai Burtescu-2/+2
2020-03-21Rollup merge of #70138 - RalfJung:throw-not-return, r=oli-obkMazdak Farrokhzad-5/+5
do not 'return' in 'throw_' macros In https://github.com/rust-lang/rust/pull/69839 we turned a closure into a `try` block, but it turns out that does not work with our `throw_` macros, which `return` so they skip the `try`. Here we fix that. For some reason that means we also have to remove some `;`. r? @oli-obk
2020-03-21Rollup merge of #69934 - andjo403:inlinecost, r=wesleywiserMazdak Farrokhzad-2/+17
Update the mir inline costs handle that when mir is lowered to llvm-ir more code is generated. Landingpads generates 10 llvm-ir instructions and resume 9 llvm-ir instructions. r? @wesleywiser
2020-03-21Rollup merge of #70187 - matthiaskrgr:cl2ppy, r=Mark-SimulacrumMazdak Farrokhzad-1/+1
more clippy fixes * remove redundant returns (clippy::needless_return) * remove redundant import (clippy::single_component_path_imports) * remove redundant format!() call (clippy::useless_format) * don't use ok() before calling expect() (clippy::ok_expect)
2020-03-20remove redundant returns (clippy::needless_return)Matthias Krüger-1/+1
2020-03-19Use erased regions in MIRMatthew Jasper-83/+20
2020-03-19do not 'return' in 'throw_' macrosRalf Jung-5/+5
2020-03-19Rollup merge of #69814 - jonas-schievink:gen-ret-unw, r=ZoxcMazdak Farrokhzad-7/+104
Smaller and more correct generator codegen This removes unnecessary panicking branches in the resume function when the generator can not return or unwind, respectively. Closes https://github.com/rust-lang/rust/issues/66100 It also addresses the correctness concerns wrt poisoning on unwind. These are not currently a soundness issue because any operation *inside* a generator that could possibly unwind will result in a cleanup path for dropping it, ultimately reaching a `Resume` terminator, which we already handled correctly. Future MIR optimizations might optimize that out, though. r? @Zoxc
2020-03-18Rollup merge of #69920 - Centril:hir-cleanup, r=ZoxcMazdak Farrokhzad-18/+13
Remove some imports to the rustc crate - When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code). - Use `rustc_session::` imports instead of `rustc::{session, lint}`. r? @Zoxc
2020-03-17Hold index of generator `self` arg in `const`Dylan MacKenzie-21/+18
2020-03-16Rollup merge of #67335 - ecstatic-morse:qualif-refactor, r=eddybDylan DPC-202/+178
Refactor the `Qualif` trait This PR attempts to preserve the existing semantics of the `Qualif` trait while reducing its API to two significant methods with descriptive names, `in_any_value_of_ty` and `in_adt_inherently`. The other `in_*` methods have been made into free functions, since they should never be overloaded. Finally, I changed the bounds on the `in_local` argument to be less restrictive (`FnMut` instead of `Fn`), which addresses a FIXME in the const-checker. r? @eddyb cc @pnkfelix @oli-obk
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-14/+11
2020-03-16remove unnecessary hir::map importsMazdak Farrokhzad-4/+2
2020-03-15Auto merge of #68944 - Zoxc:hir-map, r=eddybbors-2/+2
Use queries for the HIR map r? @eddyb cc @michaelwoerister
2020-03-14Return feature gate as a `Symbol`Dylan MacKenzie-29/+32
2020-03-14Simplify `Qualif` interfaceDylan MacKenzie-202/+178
2020-03-14Index HIR after creating TyCtxtJohn Kåre Alsaker-2/+2
2020-03-14Swap inserts to keep the original orderingJonas Schievink-4/+4
2020-03-14Make downstream crates compile.Camille GILLOT-2/+3
2020-03-14Auto merge of #69716 - jonas-schievink:generator-size, r=tmandrybors-1/+1
Don't store locals in generators that are immediately overwritten with the resume argument This fixes https://github.com/rust-lang/rust/issues/69672 and makes https://github.com/rust-lang/rust/pull/69033 pass the async fn size tests again (in other words, there will be no size regression of async fn if both this and https://github.com/rust-lang/rust/pull/69033 land). ~~This is a small botch and I'd rather have a more precise analysis, but that seems much harder to pull off, so this special-cases `Yield` terminators that store the resume argument into a simple local (ie. without any field projections) and explicitly marks that local as "not live" in the suspend point of that yield. We know that this local does not need to be stored in the generator for this suspend point because the next resume would immediately overwrite it with the passed-in resume argument anyways. The local might still end up in the state if it is used across another yield.~~ (this now properly updates the dataflow framework to handle this case)
2020-03-14Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddybYuki Okushi-3/+3
remove lifetimes that can be elided (clippy::needless_lifetimes)
2020-03-14Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPCYuki Okushi-1/+1
fix more clippy findings * reduce references on match patterns (clippy::match_ref_pats) * Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline) * libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string) * remove unneeded mutable references (cippy::unnecessary_mut_passed) * libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast) * rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes) * call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref) * iterate over a maps values directly. (clippy::for_kv_map) * rustdoc: simplify boolean condition (clippy::nonminimal_bool) * Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently) * rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some) * rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
2020-03-12remove lifetimes that can be elided (clippy::needless_lifetimes)Matthias Krüger-3/+3
2020-03-12Auto merge of #68551 - Marwes:allocations_mir, r=ecstatic-morsebors-7/+23
perf: Reuse a Vec in mir simplification Just moves the vec out of the outer loop so it is reused every iteration