about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-02-11Invert control in struct_lint_level.jumbatm-46/+61
Caller now passes in a `decorate` function, which is only run if the lint is allowed.
2020-02-11simplify_try: address some of eddyb's commentsMazdak Farrokhzad-0/+3
2020-02-10Add an `into_engine` method to `Analysis`Dylan MacKenzie-4/+5
This makes it more ergonomic to create a dataflow engine and obviates the need to pick between `new_gen_kill` and `new_generic`.
2020-02-10handle TerminatorKind::Yield by returning Err(Unpromotable)Chris Simpkins-0/+1
2020-02-09Make issue references consistentMatthias Prechtl-4/+7
2020-02-09const-prop: use overflowing_unary_op for overflowing checking of unary opsRalf Jung-17/+17
2020-02-07Rollup merge of #68164 - tmiasko:no-sanitize, r=nikomatsakisDylan DPC-0/+23
Selectively disable sanitizer instrumentation Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function.
2020-02-06Rollup merge of #68524 - jonas-schievink:generator-resume-arguments, r=ZoxcDylan DPC-26/+94
Generator Resume Arguments cc https://github.com/rust-lang/rust/issues/43122 and https://github.com/rust-lang/rust/issues/56974 Blockers: * [x] Fix miscompilation when resume argument is live across a yield point (https://github.com/rust-lang/rust/pull/68524#issuecomment-578459069) * [x] Fix 10% compile time regression in `await-call-tree` benchmarks (https://github.com/rust-lang/rust/pull/68524#issuecomment-578487162) * [x] Fix remaining 1-3% regression (https://github.com/rust-lang/rust/pull/68524#issuecomment-579566255) - resolved (https://github.com/rust-lang/rust/pull/68524#issuecomment-581144901) * [x] Make dropck rules account for resume arguments (https://github.com/rust-lang/rust/pull/68524#issuecomment-578541137) Follow-up work: * Change async/await desugaring to make use of this feature * Rewrite [`box_region.rs`](https://github.com/rust-lang/rust/blob/3d8778d767f0dde6fe2bc9459f21ead8e124d8cb/src/librustc_data_structures/box_region.rs) to use resume arguments (this shows up in profiles too)
2020-02-06Clarify comment about `_2` living across a yieldJonas Schievink-2/+3
2020-02-05Selectively disable sanitizer instrumentationTomasz Miąsko-0/+23
Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function.
2020-02-04Don't emit StorageDead for the resume argumentJonas Schievink-4/+0
2020-02-04Auto merge of #68804 - ecstatic-morse:qualif-cursor-lazy, r=estebankbors-53/+36
Always use lazy qualif getters during const-checking `has_mut_interior_eager_seek` was needed to work around an overly restrictive bound on the `per_local` argument to the `Qualif` trait. This PR makes that bound `FnMut` instead of `Fn` so we can seek cursors inside of it, resolving a FIXME in the const-checking code.
2020-02-03Treat `Rvalue::AddressOf` the same as `Rvalue::Ref`Dylan MacKenzie-18/+11
2020-02-03Eliminate "eager" qualif getterDylan MacKenzie-22/+6
All qualif getters are now lazy
2020-02-03Pass correct closure type to `Qualif` methodsDylan MacKenzie-5/+11
2020-02-03Take `FnMut` instead of `Fn` in `Qualif` methodsDylan MacKenzie-10/+10
2020-02-03Fix miscompilationJonas Schievink-10/+53
2020-02-02No resume argument in the drop shimJonas Schievink-18/+33
2020-02-02Make generator transform move resume arg aroundJonas Schievink-7/+19
The resume arg is passed as argument `_2` and needs to be moved to the `Yield`s target `Place`
2020-02-02Add a resume type parameter to `Generator`Jonas Schievink-1/+2
2020-02-02Rollup merge of #68460 - sinkuu:emit_mir_buffered, r=Mark-SimulacrumYuki Okushi-1/+1
Use BufWriter for emitting MIR I noticed that `--emit=mir` takes long time on a large crate. https://github.com/rust-lang/rust/pull/64344 seem to have fixed `-Zdump-mir`, but not `--emit=mir`.
2020-02-011. move allow_internal_unstable to rustc_attrMazdak Farrokhzad-1/+2
2. as a result, drop rustc_errors dep from syntax
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-02-01Use BufWriterShotaro Yamada-1/+1
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-1/+1
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-31Rollup merge of #68588 - Centril:check-unsafety-clean, r=Mark-SimulacrumDylan DPC-39/+18
check_unsafety: more code reuse r? oli-obk
2020-01-28./x.py fmtSantiago Pastorino-2/+1
2020-01-28Place::ty_from takes local by valueSantiago Pastorino-15/+15
2020-01-28Local field on PlaceRef and RootPlace is not a reference anymoreSantiago Pastorino-12/+12
2020-01-28make_integrate_local takes Local by valueSantiago Pastorino-4/+4
2020-01-28check_unsafety: more code reuseMazdak Farrokhzad-39/+18
2020-01-27don't clone types that are copy, round two.Matthias Krüger-17/+13
2020-01-24Normalise notes with the/isvarkor-1/+1
2020-01-23Make pointers to statics internalMatthew Jasper-22/+24
2020-01-22librustc_mir: don't allocate vectors where slices will do.Matthias Krüger-3/+3
2020-01-21Auto merge of #68423 - Centril:rollup-bdjykrv, r=Centrilbors-2/+9
Rollup of 7 pull requests Successful merges: - #67686 (Simplify NodeHeader by avoiding slices in BTreeMaps with shared roots) - #68140 (Implement `?const` opt-out for trait bounds) - #68313 (Options IP_MULTICAST_TTL and IP_MULTICAST_LOOP are 1 byte on BSD) - #68328 (Actually pass target LLVM args to LLVM) - #68399 (check_match: misc unifications and ICE fixes) - #68415 (tidy: fix most clippy warnings) - #68416 (lowering: cleanup some hofs) Failed merges: r? @ghost
2020-01-21Rollup merge of #68140 - ecstatic-morse:const-trait-bound-opt-out, r=oli-obkMazdak Farrokhzad-2/+9
Implement `?const` opt-out for trait bounds For now, such bounds are treated exactly the same as unprefixed ones in all contexts. [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) does not specify whether such bounds are forbidden outside of `const` contexts, so they are allowed at the moment. Prior to this PR, the constness of a trait bound/impl was stored in `TraitRef`. Now, the constness of an `impl` is stored in `ast::ItemKind::Impl` and the constness of a bound in `ast::TraitBoundModifer`. Additionally, constness of trait bounds is now stored in an additional field of `ty::Predicate::Trait`, and the combination of the constness of the item along with any `TraitBoundModifier` determines the constness of the bound in accordance with the RFC. Encoding the constness of impls at the `ty` level is left for a later PR. After a discussion in \#wg-grammar on Discord, it was decided that the grammar should not encode the mutual exclusivity of trait bound modifiers. The grammar for trait bound modifiers remains `[?const] [?]`. To encode this, I add a dummy variant to `ast::TraitBoundModifier` that is used when the syntax `?const ?` appears. This variant causes an error in AST validation and disappears during HIR lowering. cc #67794 r? @oli-obk
2020-01-21Auto merge of #65672 - ecstatic-morse:unified-dataflow-proto, r=pnkfelixbors-10/+12
A single framework for gen-kill and generic dataflow problems This is the prototype implementation discussed in rust-lang/compiler-team#202. You can read a high-level description of it in [the proposal](https://hackmd.io/@39Qr_z9cQhasi25sGjmFnA/Skvd9rztS) for that design meeting. This would eventually supersede the existing `BitDenotation` interface. r? @ghost cc @rust-lang/compiler (esp. @eddyb and @pnkfelix)
2020-01-21Rollup merge of #68297 - Aaron1011:fix/new-const-prop-bounds, r=oli-obkYuki Okushi-22/+22
Filter and test predicates using `normalize_and_test_predicates` for const-prop Fixes #68264 Previously, I attempted to use `substitute_normalize_and_test_predicates` to detect unsatisfiable bounds. Unfortunately, since const-prop runs in a generic environment (we don't have any of the function's generic parameters substituted), this could lead to cycle errors when attempting to normalize predicates. This check is replaced with a more precise check. We now only call `normalize_and_test_predicates` on predicates that have the possibility of being proved unsatisfiable - that is, predicates that don't depend on anything local to the function (e.g. generic parameters). This ensures that we don't hit cycle errors when we normalize said predicates, while still ensuring that we detect unsatisfiable predicates. I haven't been able to come up with a minimization of the Diesel issue - however, I've verified that it compiles successfully.
2020-01-20Add `constness` field to `ty::Predicate::Trait`Dylan MacKenzie-2/+9
2020-01-20Rollup merge of #68353 - Centril:code-liberation, r=petrochenkovDylan DPC-5/+0
Remove `rustc_error_codes` deps except in `rustc_driver` Remove dependencies on `rustc_error_codes` in all crates except for `rustc_driver`. This has some benefits: 1. Adding a new error code when hacking on the compiler only requires rebuilding at most `rustc_error_codes`, `rustc_driver`, and the reflexive & transitive closure of the crate where the new error code is being added and its reverse dependencies. This improves time-to-UI-tests (TTUT). 2. Adding an error description to an error code only requires rebuilding `rustc_error_codes` and `rustc_driver`. This should substantially improve TTUT. r? @petrochenkov cc @rust-lang/wg-diagnostics
2020-01-18[const-prop] Run `x.py fmt`Wesley Wiser-5/+1
2020-01-18[const-prop] Remove useless typedefWesley Wiser-7/+5
It's confusing because it conflicts with ty::Const and just isn't generally useful.
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-5/+0
2020-01-18Auto merge of #68170 - wesleywiser:stop_const_prop_ref_taking, r=oli-obkbors-20/+3
Turn off const propagation of ref taking Fixes #67529 Fixes #67640 Fixes #67641 Fixes #67862 r? @oli-obk
2020-01-17Stop treating `FalseEdges` and `FalseUnwind` as having semantic value for ↵Oliver Scherer-13/+6
const eval
2020-01-17Fix typoAaron Hill-1/+1
Co-Authored-By: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-01-16Filter and test predicates using `normalize_and_test_predicates` for const-propAaron Hill-22/+22
Fixes #68264 Previously, I attempted to use `substitute_normalize_and_test_predicates` to detect unsatisfiable bounds. Unfortunately, since const-prop runs in a generic environment (we don't have any of the function's generic parameters substituted), this could lead to cycle errors when attempting to normalize predicates. This check is replaced with a more precise check. We now only call `normalize_and_test_predicates` on predicates that have the possibility of being proved unsatisfiable - that is, predicates that don't depend on anything local to the function (e.g. generic parameters). This ensures that we don't hit cycle errors when we normalize said predicates, while still ensuring that we detect unsatisfiable predicates.
2020-01-15Auto merge of #67603 - oli-obk:no_mut_static_ref_from_const, r=RalfJungbors-4/+4
Promoteds can contain raw pointers, but these must still only point to immutable allocations fixes #67601 r? @RalfJung cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future
2020-01-15Rollup merge of #67914 - Aaron1011:fix/const-prop-impossible, ↵Yuki Okushi-0/+41
r=matthewjasper,oli-obk Don't run const propagation on items with inconsistent bounds Fixes #67696 Using `#![feature(trivial_bounds)]`, it's possible to write functions with unsatisfiable 'where' clauses, making them uncallable. However, the user can act as if these 'where' clauses are true inside the body of the function, leading to code that would normally be impossible to write. Since const propgation can run even without any user-written calls to a function, we need to explcitly check for these uncallable functions.