about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-03-11Update the mir inline costsAndreas Jonson-2/+17
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.
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-10Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obkMazdak Farrokhzad-5/+5
Make PlaceRef take just one lifetime r? @eddyb
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-2/+3
2020-03-08move error allocation test to error.rsRalf Jung-26/+9
2020-03-08Apply suggestions from code reviewJonas Schievink-2/+2
Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
2020-03-08Change index for SwitchInt caseJonas Schievink-1/+1
The indices do not matter here, and this fixes an index out of bounds panic when compiling a generator that can unwind but not return.
2020-03-08Poison generators when any terminator unwindsJonas Schievink-5/+31
This didn't cause issues before since generator types were always considered to "need drop", leading to unwind paths (including a `Resume` block) always getting generated.
2020-03-07Don't insert panic when generator can not unwindJonas Schievink-1/+45
2020-03-07remove unneeded mutable references (cippy::unnecessary_mut_passed)Matthias Krüger-1/+1
2020-03-07Don't insert panic when generator can not returnJonas Schievink-2/+29
2020-03-07Rollup merge of #69787 - spastorino:use-local-directly-its-copy, r=oli-obkMazdak Farrokhzad-6/+6
mir::Local is Copy we can pass it by value in these cases r? @oli-obk
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-2/+2
fix various typos
2020-03-07Rollup merge of #69782 - matthiaskrgr:redundant_field_name_rep, r=cramertjMazdak Farrokhzad-4/+4
Don't redundantly repeat field names (clippy::redundant_field_names)
2020-03-07Rollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obkMazdak Farrokhzad-1/+1
Use .next() instead of .nth(0) on iterators.
2020-03-06mir::Local is Copy we can pass it by value in these casesSantiago Pastorino-6/+6
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-4/+4
2020-03-06fix various typosMatthias Krüger-2/+2
2020-03-06Model generator resumption in dataflowJonas Schievink-2/+2
We now have a way to apply an effect only *after* a `yield` resumes, similar to calls (which can either return or unwind).
2020-03-05Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)Matthias Krüger-2/+2
2020-03-04PlaceRef<'a, 'tcx> -> PlaceRef<'tcx>Santiago Pastorino-5/+5
2020-03-04Make PlaceRef lifetimes of in_projection be both 'tcxSantiago Pastorino-3/+3
2020-03-04Auto merge of #69550 - RalfJung:scalar, r=oli-obkbors-1/+3
interpret engine: Scalar cleanup * Remove `to_ptr` * Make `to_bits` private r? @oli-obk
2020-03-03Use .next() instead of .nth(0) on iterators.Matthias Krüger-1/+1
2020-03-02s/merged_block_count/statements_to_merge/gMarkus Westerlind-3/+3
2020-03-01Auto merge of #69408 - RalfJung:canonical-alloc-id, r=oli-obkbors-12/+0
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-03-01Auto merge of #69295 - ecstatic-morse:unified-dataflow-generators, r=tmandrybors-58/+35
Use new dataflow framework for generators #65672 introduced a new dataflow framework that can handle arbitrarily complex transfer functions as well as ones expressed as a series of gen/kill operations. This PR ports the analyses used to implement generators to the new framework so that we can remove the old one. See #68241 for a prior example of this. The new framework has some superficial API changes, but this shouldn't alter the generator passes in any way. r? @tmandry
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-4/+4
Rename `libsyntax` to `librustc_ast` This was the last rustc crate that wasn't following the `rustc_*` naming convention. Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-4/+4
2020-02-29Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=CentrilDylan DPC-2/+2
use .iter() instead of .into_iter() on references
2020-02-28Process `RequiresStorage` results in pre-orderDylan MacKenzie-2/+3
Reverse post-order requires an allocation.
2020-02-29use .iter() instead of .into_iter() on references.Matthias Krüger-2/+2
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-1/+1
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-28Rollup merge of #69541 - dotdash:format, r=Mark-SimulacrumMazdak Farrokhzad-4/+2
Remove unneeded calls to format!()
2020-02-28Rollup merge of #69481 - matthiaskrgr:single_char, r=ecstatic-morseMazdak Farrokhzad-1/+1
use char instead of &str for single char patterns
2020-02-28remove ScalarMaybeUndef::to_bits and make Scalar::to_bits privateRalf Jung-1/+3
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-1/+1
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-1/+1
example: let s: String = format!("hello").into();
2020-02-27Rename `RequiresStorage` to `MaybeRequiresStorage`Dylan MacKenzie-3/+3
...to be consistent with the naming of other dataflow analyses.
2020-02-27Port `RequiresStorage` to new dataflow frameworkDylan MacKenzie-49/+27
2020-02-27Port `MaybeStorageLive` to new dataflow frameworkDylan MacKenzie-8/+6
2020-02-27Remove unneeded calls to format!()Björn Steinbrink-4/+2
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-02-23miri/machine: add canonical_alloc_id hook to replace find_foreign_staticRalf Jung-12/+0
2020-02-22Auto merge of #69333 - ecstatic-morse:revert-simd-shuffle, r=petrochenkovbors-5/+19
Revert #69280 Resolves #69313 by reverting #69280. After #69280, `#[rustc_args_required_const(2)]` is required on the declaration of `simd_shuffle` intrinsics. This is allowed breakage, since you can't define platform intrinsics on stable. However, the latest release of the widely used `packed_simd` crate defines these intrinsics without the requisite attribute. Since there's no urgency to merge #69280, let's revert it. We can reconsider when rust-lang/packed_simd#278 is included in a point release of `packed_simd`. r? @petrochenkov
2020-02-22Auto merge of #69302 - jonas-schievink:yield-needs-storage, r=Zoxcbors-3/+18
Fix generator miscompilations Fixes https://github.com/rust-lang/rust/issues/69039 r? @Zoxc
2020-02-20Revert "Rollup merge of #69280 - ↵Dylan MacKenzie-5/+19
ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov" This reverts commit 61d3b6dedb1ec1f3e3cbd3d66b1a3453225bc37c, reversing changes made to c6ad1e2c2a0c7e48537617d36085f866fa6a65a3.
2020-02-20Rollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obkMazdak Farrokhzad-91/+86
Unify and improve const-prop lints Add a single helper method for all lints emitted by const-prop, and make that lint different from the CTFE `const_err` lint. Also consistently check overflow on *arithmetic*, not on the assertion, to make behavior the same for debug and release builds. See [this summary comment](https://github.com/rust-lang/rust/pull/69185#issuecomment-587924754) for details and the latest status. In terms of lint formatting, I went for what seems to be the better style: have a general message above the code, and then a specific message at the span: ``` error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 | LL | let a_i128 = -std::i128::MIN; | ^^^^^^^^^^^^^^^ attempt to negate with overflow ``` We could also just have the specific message above and no text at the span if that is preferred. I also converted some of the existing tests to use compiletest revisions, so that the same test can check a bunch of different compile flags. Fixes https://github.com/rust-lang/rust/issues/69020. Helps with https://github.com/rust-lang/rust/issues/69021: debug/release are now consistent, but the assoc-const test in that issue still fails (there is a FIXME in the PR for this). The reason seems to be that const-prop notices the assoc const in `T::N << 42` and does not even bother calling `const_prop` on that operation. Has no effect on https://github.com/rust-lang/rust/issues/61821; the duplication there has entirely different reasons.
2020-02-20Auto merge of #68847 - ecstatic-morse:const-impl, r=oli-obkbors-3/+25
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