about summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2020-02-19Add more comments to `SuspensionPoint`Jonas Schievink-3/+9
2020-02-19Remap the resume place if necessaryJonas Schievink-0/+9
2020-02-19Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, ↵Dylan DPC-19/+5
r=petrochenkov Remove special case for `simd_shuffle` arg promotion After rust-lang/stdarch#825, these intrinsics are now defined with `#[rustc_args_required_const(2)]`, so the special-case is no longer necessary.
2020-02-18Remove mention of `simd_shuffle` promotion from commentsDylan MacKenzie-7/+5
2020-02-18Remove special case for `simd_shuffle` arg promotionDylan MacKenzie-12/+0
After rust-lang/stdarch#825, these intrinsics are now defined with `#[rustc_args_required_const(2)]`, so the special-case is no longer necessary.
2020-02-18Prevent const trait methods from being marked stableDylan MacKenzie-0/+8
2020-02-18Check for trait methods on concrete types in const checkingDylan MacKenzie-3/+17
2020-02-19Auto merge of #69113 - ecstatic-morse:unified-dataflow-borrowed, r=wesleywiserbors-52/+33
Combine `HaveBeenBorrowedLocals` and `IndirectlyMutableLocals` into one dataflow analysis This PR began as an attempt to port `HaveBeenBorrowedLocals` to the new dataflow framework (see #68241 for prior art). Along the way, I noticed that it could share most of its code with `IndirectlyMutableLocals` and then found a few bugs in the two analyses: - Neither one marked locals as borrowed after an `Rvalue::AddressOf`. - `IndirectlyMutableLocals` was missing a minor fix that `HaveBeenBorrowedLocals` got in #61069. This is not a problem today since it is only used during const-checking, where custom drop glue is forbidden. However, this may change some day. I decided to combine the two analyses so that they wouldn't diverge in the future while ensuring that they remain distinct types (called `MaybeBorrowedLocals` and `MaybeMutBorrowedLocals` to be consistent with the `Maybe{Un,}InitializedPlaces` naming scheme). I fixed the bugs and switched to exhaustive matching where possible to make them less likely in the future. Finally, I added comments explaining some of the finer points of the transfer function for these analyses (see #61069 and #65006).
2020-02-18better lint namesRalf Jung-4/+4
2020-02-18Rollup merge of #69146 - matthewjasper:literal-qualif, r=eddybMazdak Farrokhzad-17/+8
Always const qualify literals by type r? @eddyb
2020-02-16Clarify mir block mergingMarkus Westerlind-1/+5
2020-02-16Make librustc_mir compile.Camille GILLOT-2/+3
2020-02-16Auto merge of #69156 - ecstatic-morse:unified-dataflow-impls2, r=eddybbors-83/+41
Use `ResultsCursor` for `elaborate_drops` Some cleanup after #68241. The old code was using a custom cursor-like struct called `InitializationData`.
2020-02-15Tighter type bounds for messagesRalf Jung-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-15Always qualify literals by typeMatthew Jasper-17/+8
2020-02-15fix exceeding_bitshift lint and testRalf Jung-5/+7
2020-02-15Auto merge of #67681 - matthewjasper:infer-regions-in-borrowck, r=nikomatsakisbors-19/+26
Infer regions for opaque types in borrowck This is a step towards the goal of typeck not doing region inference. The commits up to `Arena allocate the result of mir_borrowck` are various bug fixes and prerequisites. The remaining commits move opaque type inference to borrow checking. r? @nikomatsakis
2020-02-15Rollup merge of #69051 - Centril:st-fixes, r=eddybYuki Okushi-0/+3
simplify_try: address some of eddyb's comments Addresses only https://github.com/rust-lang/rust/pull/66282#discussion_r376730986 and https://github.com/rust-lang/rust/pull/66282#discussion_r376730824. r? @eddyb cc @oli-obk
2020-02-14const-prop: use one helper method for all lints; consistently lint overflow ↵Ralf Jung-87/+80
on BinOps and not on Assert
2020-02-14Call `is_freeze` less in unsafety-checkingMatthew Jasper-19/+26
This is to avoid cycles when calling `is_freeze` on an opaque type.
2020-02-13Print flow state in debug messages for `find_dead_unwinds`Dylan MacKenzie-3/+9
2020-02-13Use more descriptive name to get `InitializationData` stateDylan MacKenzie-5/+5
2020-02-13Use `seek_before` instead of `seek_after`Dylan MacKenzie-7/+7
2020-02-13Use `ResultsCursor` for `elaborate_drops`Dylan MacKenzie-81/+33
The old code hard-coded the transfer function for the initialized places analyses.
2020-02-13Ignore mut borrow from drop terminator in const-evalDylan MacKenzie-0/+6
2020-02-13Rename `MaybeBorrowedLocals` constructorsDylan MacKenzie-3/+3
2020-02-13Auto merge of #68969 - RalfJung:dont-panic, r=oli-obkbors-68/+58
remove Panic variant from InterpError The interpreter engine itself does not raise `Panic` errors any more, so remove them from the error enum. Instead, const-prop and const-eval have to do their own handling of panics. I used the opportunity to refactor the const-eval error handling a bit to use the `MachineStop` variant. Also, in const-prop I could do some cleanup as now, no more lints are being reported in `use_ecx`. However, I am quite puzzled by why exactly the linting there works the way it does -- the code can certainly be cleaned up more, but I don't know enough of the intent to do that. I left some questions for the most confusing parts, but for now behavior should be unchanged by this PR (so, all that weirdness I am asking about is pre-existing and merely maintained here). Cc @wesleywiser Fixes https://github.com/rust-lang/rust/issues/66902 r? @oli-obk
2020-02-13perf(mir): Reserve enough space for the merged blocks before appendingMarkus Westerlind-4/+17
2020-02-13fix typoRalf Jung-1/+1
2020-02-13Avoid an intermediate Vec in mir simplifyMarkus Westerlind-7/+6
2020-02-13Use Vec::appendMarkus Westerlind-1/+1
2020-02-13Reuse a Vec in mir simplificationMarkus Westerlind-2/+2
2020-02-13rename PanicInfo -> AssertKindRalf Jung-11/+11
2020-02-13improve comments:Ralf Jung-4/+8
- comment for special handling of Shl/Shr - reference a PR
2020-02-13move PanicInfo to mir moduleRalf Jung-4/+4
2020-02-13const-prop: handle overflow_check consistently for all operatorsRalf Jung-15/+10
2020-02-13remove Panic variant from InterpErrorRalf Jung-46/+37
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-2/+1
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-12Use `MaybeMutBorrowedLocals` for const-checkingDylan MacKenzie-19/+14
2020-02-12Use `MaybeBorrowedLocals` for generator analysesDylan MacKenzie-13/+7
It should have the same semantics as `HaveBeenBorrowedLocals`
2020-02-12Reenable peek test for indirect mutation analysisDylan MacKenzie-20/+6
This uses the new `MaybeMutBorrowedLocals` pass but we keep the `rustc_peek_indirectly_mutable` since the two are interchangable except when inspecting a local after it has been marked `StorageDead`.
2020-02-12Rollup merge of #69002 - RalfJung:miri-op-overflow, r=oli-obk,wesleywiserDylan DPC-17/+17
miri: improve and simplify overflow detection This simplifies the overflow detection for signed binary operators, and adds overflow detection to unary operators so that const-prop doesn't have to crudely hand-roll that. It also fixes some bugs in the operator implementation that however, I think, were not observable. r? @oli-obk @wesleywiser
2020-02-12Auto merge of #69094 - Dylan-DPC:rollup-4qe7uv1, r=Dylan-DPCbors-0/+1
Rollup of 8 pull requests Successful merges: - #67585 (Improve `char::is_ascii_*` codegen) - #68914 (Speed up `SipHasher128`.) - #68994 (rustbuild: include channel in sanitizers installed name) - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method) - #69034 (parser: Remove `Parser::prev_token_kind`) - #69042 (Remove backtrace header text) - #69059 (Remove a few unused objects) - #69089 (Properly use the darwin archive format on Apple targets) Failed merges: r? @ghost
2020-02-12Rollup merge of #69032 - chrissimpkins:ice-yield-println-#69017, r=petrochenkovDylan DPC-0/+1
ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method IR: https://github.com/rust-lang/rust/issues/69017 regressed commit: https://github.com/rust-lang/rust/commit/f8fd4624474a68bd26694eff3536b9f3a127b2d3 Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087 Addresses ICE reported in #69017 by handling `TerminatorKind::Yield` in https://github.com/rust-lang/rust/blob/4d1241f5158ffd66730e094d8f199ed654ed52ae/src/librustc_mir/transform/promote_consts.rs#L465-L468. <details><summary>Nightly build</summary> <p> ``` $ cargo +nightly build Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder) error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable --> src/main.rs:8:27 | 8 | println!("-> {}", yield); | ^^^^^ thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.43.0-nightly (71c7e149e 2020-02-09) running on x86_64-apple-darwin note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin note: some of the compiler flags provided by cargo are hidden error: aborting due to previous error error: could not compile `yielder`. To learn more, run the command again with --verbose. ``` </p> </details> <details><summary>Stage 1 dev build</summary> <p> ``` $ cargo +stage1 build Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder) warning: function is never used: `gen` --> src/main.rs:6:4 | 6 | fn gen() -> impl Generator<usize> { | ^^^ | = note: `#[warn(dead_code)]` on by default Finished dev [unoptimized + debuginfo] target(s) in 0.53s ``` </p> </details> @jonas-schievink @oli-obk
2020-02-12Auto merge of #68241 - ecstatic-morse:unified-dataflow-impls, r=pnkfelixbors-81/+57
Migrate borrowck dataflow impls to new framework This uses #65672 to implement the dataflow analyses needed by borrowck. These include all the `InitializedPlaces` analyses as well as `Borrows`. Additionally, this PR contains several independent changes around the dataflow API which improve performance and make it more ergonomic. * An optimization that inhibits the caching of block transfer functions for acyclic MIR (~0.3% I-CNT savings). * A `ResultsVisitor` for dataflow results that is more efficient than `ResultsCursor` when we have to visit every statement unconditionally (~0.3% I-CNT savings). * An `into_engine` method on `Analysis` that selects the appropriate `Engine` constructor. * A `contains` method for `ResultsCursor` as a shorthand for `.get().contains()`. * A `find_descendants` helper on `MovePath` that replaces `has_any_child_of` on the old `FlowsAtLocation` These changes made porting the dataflow analyses much easier. Finally, this PR removes some now-unused code in `dataflow/at_location.rs` and elsewhere. You can view the perf results for the final version of this PR [here](https://perf.rust-lang.org/compare.html?start=29b854fb741809c29764e33fc17c32ba9c6523ba&end=6e516c1410c18cfe4eb6d030a39fdb73c8d8a4fe). Here's an example of the graphviz diagrams that are generated for the `MaybeInitializedPlaces` analysis. ![image](https://user-images.githubusercontent.com/29463364/72846117-c3e97d80-3c54-11ea-8171-3d48981c9ddd.png)
2020-02-11Add note about `elaborate_drops::InitializationData`Dylan MacKenzie-0/+3
2020-02-11Use new dataflow framework for `rustc_peek` testsDylan MacKenzie-42/+28
2020-02-11Use new dataflow framework for drop elaboration and borrow checkingDylan MacKenzie-35/+21
2020-02-11Move more into decorate functions.jumbatm-14/+16
2020-02-11Run RustFmtjumbatm-11/+16