about summary refs log tree commit diff
path: root/src/librustc_borrowck
AgeCommit message (Collapse)AuthorLines
2016-06-16Auto merge of #34290 - arielb1:short-ladder, r=eddybbors-6/+15
don't generate drop ladder steps for fields that don't need dropping cc @eddyb This should help with #34166
2016-06-16don't generate drop ladder steps for fields that don't need droppingAriel Ben-Yehuda-6/+15
2016-06-15prefer `if let` to match with `None => ()` arm in some placesZack M. Davis-9/+6
Casual grepping revealed some places in the codebase (some of which antedated `if let`'s December 2014 stabilization in c200ae5a) where we were using a match with a `None => ()` arm where (in the present author's opinion) an `if let` conditional would be more readable. (Other places where matching to the unit value did seem to better express the intent were left alone.) It's likely that we don't care about making such trivial, non-functional, sheerly æsthetic changes. But if we do, this is a patch.
2016-06-12Auto merge of #34133 - m-decoster:master, r=GuillaumeGomezbors-2/+100
Add explanations for E0503 and E0508. (cannot use `..` because it was mutably borrowed, cannot move out of type `..`, a non-copy fixed-size array) Part of #32777.
2016-06-12Add explanation for E0503Mathieu De Coster-1/+56
2016-06-12Add explanation for E0508Mathieu De Coster-1/+44
2016-06-12Fix markdown formatting error of E0277, E0284, E0310, E0502.kennytm-0/+3
2016-06-09Auto merge of #34149 - arielb1:remove-remove-dead-blocks, r=nikomatsakisbors-152/+139
MIR cleanups and predecessor cache This PR cleans up a few things in MIR and adds a predecessor cache to allow graph algorithms to be run easily. r? @nikomatsakis
2016-06-09use the type name as the pass nameAriel Ben-Yehuda-3/+1
2016-06-09add hook infrastructure for automatically dumping MIR on every passAriel Ben-Yehuda-4/+3
2016-06-09introduce an `unreachable` terminatorAriel Ben-Yehuda-2/+5
Use it instead of a `panic` for inexhaustive matches and correct the comment. I think we trust our match-generation algorithm enough to generate these blocks, and not generating an `unreachable` means that LLVM won't optimize `match void() {}` to an `unreachable`.
2016-06-09make the basic_blocks field privateAriel Ben-Yehuda-59/+53
2016-06-09introduce the type-safe IdxVec and use it instead of loose indexesAriel Ben-Yehuda-92/+85
2016-06-09Auto merge of #34109 - pnkfelix:fix-issue-34101, r=arielb1bors-28/+47
Fix issue #34101 Fix issue #34101: do not track subcontent of type with dtor nor gather flags for untracked content. (Includes a regression test, which needed to go into `compile-fail/` due to weaknesses when combining `#[deny(warnings)]` with `tcx.sess.span_warn(..)`)
2016-06-09implement RFC495 semantics for slice patternsAriel Ben-Yehuda-16/+2
non-MIR translation is still not supported for these and will happily ICE. This is a [breaking-change] for many uses of slice_patterns.
2016-06-07mir: group span + visibility scope under a new SourceInfo type.Eduard Burtescu-34/+27
2016-06-07Fix issue #34101: do not track subcontent of type with dtor nor gather flags ↵Felix S. Klock II-28/+47
for untracked content. (Includes a regression test, which needed to go into `compile-fail/` due to weaknesses when combining `#[deny(warnings)]` with `tcx.sess.span_warn(..)`) (updated with review feedback from arielb1.)
2016-06-07Auto merge of #34012 - eddyb:tick-erased, r=nikomatsakisbors-1/+2
rustc: add ReErased to be used by trait selection, MIR and trans. `ReErased` replaces `ReStatic` (i.e. `'static`) for erasing regions. Using a distinct lifetime helps prevent accidental mix-ups between the two. It also allows cleaner type printing (see test changes), including in symbol names: ```rust str..pattern..CharSearcher$LT$$u27$static$GT$::drop.30560::h840c2f2afc03bbea // before str..pattern..CharSearcher::drop.30561::h6bd31d2af614377a // after ``` Not that we should be producing symbols this way, but it's still better.
2016-06-05Add a new Assert terminator to MIR for bounds & arithmetic checks.Eduard Burtescu-1/+18
2016-06-05Check arithmetic in the MIRJames Miller-1/+2
Add, Sub, Mul, Shl, and Shr are checked using a new Rvalue: CheckedBinaryOp, while Div, Rem and Neg are handled with explicit checks in the MIR.
2016-06-05rustc: add ReErased to be used by trait selection, MIR and trans.Eduard Burtescu-1/+2
2016-06-05break critical edges only when neededAriel Ben-Yehuda-32/+28
the *only* place where critical edges need to be broken is on Call instructions, so only break them there.
2016-06-04fix translation of terminators in MSVC cleanup blocksAriel Ben-Yehuda-2/+4
MSVC requires unwinding code to be split to a tree of *funclets*, where each funclet can only branch to itself or to to its parent. Luckily, the code we generates matches this pattern. Recover that structure in an analyze pass and translate according to that.
2016-06-04jump to the cleanup block in the unwind path for open_drop_for_boxAriel Ben-Yehuda-8/+16
silly bug. Hopefully the last one.
2016-06-03address review commentsAriel Ben-Yehuda-79/+83
2016-06-03implement drop elaborationAriel Ben-Yehuda-2/+1265
Fixes #30380
2016-06-03introduce DropAndReplace for translating assignmentsAriel Ben-Yehuda-8/+31
this introduces a DropAndReplace terminator as a fix to #30380. That terminator is suppsoed to be translated by desugaring during drop elaboration, which is not implemented in this commit, so this breaks `-Z orbit` temporarily.
2016-05-30Rollup merge of #33793 - GuillaumeGomez:compile_fail, r=GuillaumeGomezManish Goregaokar-1/+1
Fix compile_fail tag Fixes #33780 r? @steveklabnik
2016-05-29Auto merge of #33929 - petrochenkov:pathir, r=eddybbors-1/+1
Separate bindings from other patterns in HIR Now when name resolution is done on AST, we can avoid dumping everything that looks like an identifier into `PatKind::Ident` in HIR. `hir::PatKind::Ident` is removed, fresh bindings are now called `hir::PatKind::Binding`, everything else goes to `hir::PatKind::Path`. I intend to do something with `PatKind::Path`/`PatKind::QPath` as well using resolution results, but it requires some audit and maybe some deeper refactoring of relevant resolution/type checking code to do it properly. I'm submitting this part of the patch earlier to notify interested parties that I'm working on this. cc @jseyfried r? @eddyb
2016-05-28Rollup merge of #33820 - jonathandturner:format_readability_updates, ↵Manish Goregaokar-1/+5
r=nikomatsakis Increase spacing in error format for readability. Two small tweaks that seem to help readability quite a bit: * Add spacing header<->snippet, but use the |> on the side for visual consistency * Fix #33819 * Fix #33763 * Move format-sensitive test (issue-26480 in cfail) to ui test r? @nikomatsakis
2016-05-28Separate bindings from other patterns in HIRVadim Petrochenkov-1/+1
2016-05-27* Fix compile_fail tag (in some cases, it compiled whereas it wasn't ↵Guillaume Gomez-1/+1
expected to and was still considered 'ok') * Fix error explanations tests/tags
2016-05-25Auto merge of #33667 - pnkfelix:fixes-to-mir-dataflow, r=arielb1bors-822/+2141
Fixes to mir dataflow Fixes to mir dataflow This collects a bunch of changes to `rustc_borrowck::borrowck::dataflow` (which others have pointed out should probably migrate to some crate that isn't tied to the borrow-checker -- but I have not attempted that here, especially since there are competing approaches to dataflow that we should also evaluate). These changes: 1. Provide a family of related analyses: MovingOutStatements (which is what the old AST-based dataflo computed), as well as MaybeInitialized, MaybeUninitalized, and DefinitelyInitialized. * (The last two are actually inverses of each other; we should pick one and drop the other.) 2. Fix bugs in the pre-existing analysis implementation, which was untested and thus some obvious bugs went unnoticed, which brings us to the third point: 3. Add a unit test infrastructure for the MIR dataflow analysis. * The tests work by adding a new intrinsic that is able to query the analysis state for a particular expression (technically, a particular L-value). * See the examples in compile-fail/mir-dataflow/inits-1.rs and compile-fail/mir-dataflow/uninits-1.rs * These tests are only checking the results for MaybeInitialized, MaybeUninitalized, and DefinitelyInitialized; I am not sure if it will be feasible to generalize this testing strategy to the MovingOutStatements dataflow operator.
2016-05-25Alpha rename `OwnIdxSet` to `IdxSetBuf`.Felix S. Klock II-18/+18
2016-05-25fixes to `indexed_set`: add comments and fix `PhantomData` def'n.Felix S. Klock II-2/+15
2016-05-25remove `indexed_set::Indexed` trait.Felix S. Klock II-4/+0
2016-05-25remove unnecessary use of `indexed_set::Indexed` trait.Felix S. Klock II-9/+1
2016-05-25Add notes that data-structures should potentially move to different crate.Felix S. Klock II-0/+5
2016-05-25Fix some comments.Felix S. Klock II-7/+8
2016-05-24placate tidy in `mir::gather_moves`.Felix S. Klock II-1/+2
2016-05-24placate tidy in `mir::dataflow`.Felix S. Klock II-3/+2
2016-05-24placate tidy in `mir::dataflow::graphviz`.Felix S. Klock II-3/+7
2016-05-24threaded a `ty::ParameterEnvironment` for the current node id via the ↵Felix S. Klock II-44/+56
associated Ctxt item. used this to address a long-standing wart/bug in how filtering-out of values with type impl'ing `Copy` was done.
2016-05-24Removed `type Bit` and `fn interpret` items from `trait BitDenotation`.Felix S. Klock II-62/+21
Also got rid of the `trait HasMoveData`, since I am now just imposing the constraint that `BitDenotation<Ctxt=MoveData<'tcx>>` where necessary instead.
2016-05-24Replaced use of `interpret` method in `mir::dataflow::graphviz` with a ↵Felix S. Klock II-76/+94
client-provided closure.
2016-05-24move the `tcx` and `mir` parts of associated `Ctxt` onto each ↵Felix S. Klock II-79/+77
`BitDenotation` impl.
2016-05-24Moved the four impls of `BitDenotation` to their own module, `mod impls`.Felix S. Klock II-569/+588
2016-05-24`mir::dataflow::sanity_check`: extract an `fn each_block` to simplify ↵Felix S. Klock II-76/+86
presentation. As a drive-by: unified pair of match arms that flowed to `bug!`, and replaced `bug!` invocation with a diagnostic `span_err` invocation.
2016-05-24Fix comment within sanity_check.Felix S. Klock II-3/+4
2016-05-24bug fix to `borrowck::indexed_set`: wanted bit-count not byte-count.Felix S. Klock II-1/+1