summary refs log tree commit diff
path: root/src/librustc_mir/transform
AgeCommit message (Collapse)AuthorLines
2017-08-25rustc: Add a FIXME for `try_get` in MIR inliningAlex Crichton-1/+6
It sounds like this is being handled elsewhere, so for now just preserve the existing behavior of ignoring th error.
2017-08-21Moved support code for `rustc_mir::borrow_check` query out of `mod transform`.Felix S. Klock II-1244/+0
2017-08-21Remove the `rustc_mir::transform` entry point for mir-borrowck.Felix S. Klock II-24/+1
2017-08-21Expose mir-borrowck via a query.Felix S. Klock II-2/+3
(A followup commit removes the mir::transform based entry point.)
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-20/+3
2017-08-17Auto merge of #43902 - michaelwoerister:fix-mir-passes-promoted, r=arielb1bors-0/+8
Run MIR passes on promoted temporaries again. This seems to have been broken some time in the past (maybe here: https://github.com/rust-lang/rust/commit/9c154a67bf5c6841c39afdb90388cc3ba36dc70c#diff-2f8e8805126c84b2be3f0967ffa0af28L162). r? @arielb1
2017-08-16Address review comment: `StatementKind::StorageDead` has an effect (running ↵Felix S. Klock II-2/+10
dtors) relevant to borrowck.
2017-08-16Cleanup: Every `BitDenotation` is a `DataflowOperator`, so build that in.Felix S. Klock II-1/+0
Post-rebase: ariel confirmed `SetDiscriminant` should indeed be a mutate.
2017-08-16MIR based borrow check (opt-in).Felix S. Klock II-0/+1271
One can either use `-Z borrowck-mir` or add the `#[rustc_mir_borrowck]` attribute to opt into MIR based borrow checking. Note that regardless of whether one opts in or not, AST-based borrow check will still run as well. The errors emitted from AST-based borrow check will include a "(Ast)" suffix in their error message, while the errors emitted from MIR-based borrow check will include a "(Mir)" suffix. post-rebase: removed check for intra-statement mutual conflict; replaced with assertion checking that at most one borrow is generated per statement. post-rebase: removed dead code: `IdxSet::pairs` and supporting stuff.
2017-08-16Refactor `trait BitDenotation` to take `Location` instead of ↵Felix S. Klock II-2/+2
`BasicBlock`/`usize` argument pairs.
2017-08-16Run MIR passes on promoted temporaries again.Michael Woerister-0/+8
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-48/+48
Like #43008 (f668999), but _much more aggressive_.
2017-08-13Rollup merge of #43814 - Eijebong:fix_typos2, r=petrochenkovGuillaume Gomez-1/+1
Fix some typos Follow up of #43794 If refined my script a little bit and found some more.
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-12Check #[thread_local] statics correctly in the compiler.Eduard-Mihai Burtescu-1/+19
2017-08-11Auto merge of #43748 - RalfJung:mir-validate2, r=arielb1bors-34/+43
AddValidation: handle Call terminators into blocks that have multiple incoming edges The old code was just wrong: It would add validation on paths that don't even come from the call, and it would add multiple validations if multiple calls end return to the same block.
2017-08-10Auto merge of #43559 - Nashenas88:nll-region-renumberer, r=arielb1bors-14/+113
Non-lexical lifetimes region renumberer Regenerates region variables for all regions in a cloned MIR in the nll mir pass. This is part of the work for #43234.
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-1/+1
Fixed mutable vars being marked used when they weren't #### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue. Fixes #43526, Fixes #30280, Fixes #25049 ### Issue Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings ``` fn do_thing<T>(mut arg : &mut T) { ... // don't touch arg - just deref it to access the T } ``` ### Fix Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables. #### Why not on things other than local variables? * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted. * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.
2017-08-09run AddCallGuards for *all* call edges before running AddValidationRalf Jung-34/+43
2017-08-08make `for_all_relevant_impls` O(1) againAriel Ben-Yehuda-2/+1
A change in #41911 had made `for_all_relevant_impls` do a linear scan over all impls, instead of using an HashMap. Use an HashMap again to avoid quadratic blowup when there is a large number of structs with impls. I think this fixes #43141 completely, but I want better measurements in order to be sure. As a perf patch, please don't roll this up.
2017-08-04Keep map hidden and instead move it out after visitor is finishedPaul Faria-1/+6
2017-08-04Auto merge of #43403 - RalfJung:mir-validate, r=nikomatsakisbors-8/+432
Add MIR Validate statement This adds statements to MIR that express when types are to be validated (following [Types as Contracts](https://internals.rust-lang.org/t/types-as-contracts/5562)). Obviously nothing is stabilized, and in fact a `-Z` flag has to be passed for behavior to even change at all. This is meant to make experimentation with Types as Contracts in miri possible. The design is definitely not final. Cc @nikomatsakis @aturon
2017-08-03Store map of region variable ids to lookups in nll visitor and remove ↵Paul Faria-26/+45
reference to mir
2017-08-01also release-validate return value before a callRalf Jung-8/+13
2017-08-01closure unsafety check: stop moving up when we hit an itemRalf Jung-15/+15
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-08-01use FnLike to recognize functions for usRalf Jung-63/+60
2017-08-01handle trait items as wellRalf Jung-0/+1
2017-08-01handle tuple struct ctorsRalf Jung-1/+5
2017-07-31Handle closures. Add some more tests.Ralf Jung-14/+47
2017-07-31fix AddValidation on methodsRalf Jung-2/+8
2017-07-31tidyRalf Jung-2/+2
2017-07-31optionally only emit basic validation for functions containing unsafe block ↵Ralf Jung-43/+135
/ unsafe function
2017-08-01rustc_mir::transform::simplify - remove nops firstAriel Ben-Yehuda-2/+2
Removing nops can allow more basic blocks to be merged, but merging basic blocks can't allow for more nops to be removed, so we should remove nops first. This doesn't matter *that* much, because normally we run SimplifyCfg several times, but there's no reason not to do it.
2017-07-31CleanEndRegions: use default impl where possibleRalf Jung-7/+0
2017-07-30Consume MirVisitor changes and use more accurate spans for region renumberingPaul Faria-18/+23
2017-07-30do not use doc comments inside functionsRalf Jung-1/+1
2017-07-30Renumber regions as the first step of the non-lexical lifetimes inferencePaul Faria-12/+82
2017-07-30also release/validate around non-Misc castsRalf Jung-30/+71
2017-07-30Reorder passes so that AddValidation can run after ElaborateDropsRalf Jung-15/+6
2017-07-30after a Ref, only acquire the Deref'd destinationRalf Jung-0/+4
2017-07-30please the tidyRalf Jung-5/+8
2017-07-30add -Z flag for AddValidation passRalf Jung-0/+10
2017-07-30make ValidationOperand generic so that we can reuse it in miri with a ↵Ralf Jung-1/+1
different Lvalue type
2017-07-30when suspending, we need to specify for which lifetime to recoverRalf Jung-50/+91
This matters if the lvalues that is suspended involves Deref'ing a reference -- that reference's lifetime will then not be in the type any more
2017-07-30only emit Suspend validation for mutable pathsRalf Jung-12/+41
2017-07-30add_validation: handle dropRalf Jung-2/+11
2017-07-30emit validation for function calls and RefRalf Jung-5/+88
2017-07-30CleanEndRegions: do not clean regions that occur in types in validation ↵Ralf Jung-9/+44
statements
2017-07-30add a pass for validation commands; for now just emit the initial AcquireValidRalf Jung-0/+44