about summary refs log tree commit diff
path: root/src/librustc_borrowck
AgeCommit message (Collapse)AuthorLines
2017-07-28Revert borrowck changesJohn Kåre Alsaker-26/+4
2017-07-28Update error codesJohn Kåre Alsaker-4/+4
2017-07-28Fix tidy warningsAlex Crichton-1/+1
2017-07-28Generator literal supportJohn Kåre Alsaker-6/+44
2017-07-27Auto merge of #43479 - ivanbakel:loop_borrow_msg, r=estebankbors-13/+27
Extended error message for mut borrow conflicts in loops RFC issue: https://github.com/rust-lang/rfcs/issues/2080 The error message for multiple mutable borrows on the same value over loop iterations now makes it clear that the conflict comes from the borrow outlasting the loop. The wording of the error is based on the special case of the moved-value error for a value moved in a loop. Following the example of that error, the code remains the same for the special case. This is mainly because I felt the current message is confusing in the loop case : https://github.com/rust-lang/rust/issues/43437. It's not clear that the two conflicting borrows are in different iterations of the loop, and instead it just looks like the compiler has an issue with a single line.
2017-07-25Modified error for loop mut borrow conflictsIsaac van Bakel-13/+27
Error message now makes clear that mutable borrow conflicts on a single value in a loop body is caused by the borrow outlasting a single pass of the loop. Loop conflicts are detected by seeing when two borrow locations are the same - which indicates the same code being run more than once.
2017-07-25Bump master to 1.21.0Alex Crichton-2/+0
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-17Change some helps to suggestionsOliver Schneider-1/+1
2017-07-06remove associated_consts feature gateSean McArthur-1/+2
2017-06-28Shift mir-dataflow from `rustc_borrowck` to `rustc_mir` crate.Felix S. Klock II-3259/+10
Turn `elaborate_drops` and `rustc_peek` implementations into MIR passes that also live in `rustc_mir` crate. Rewire things so `rustc_driver` uses the `ElaborateDrops` from `rustc_mir` crate.
2017-06-27rustc: move the PolyFnSig out of TyFnDef.Eduard-Mihai Burtescu-11/+6
2017-06-23Removed as many "```ignore" as possible.kennytm-10/+33
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-19Auto merge of #39409 - pnkfelix:mir-borrowck2, r=nikomatsakisbors-0/+9
MIR EndRegion Statements (was MIR dataflow for Borrows) This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow). An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...) This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
2017-06-15Update older URLs pointing to the first edition of the BookWonwoo Choi-7/+7
`compiler-plugins.html` is moved into the Unstable Book. Explanation is slightly modified to match the change.
2017-06-12Revised comment explaining my addition of case for `TerminatorKind::Resume`.Felix S. Klock II-5/+5
Also, I removed the `continue;` statement. I don't think it makes a difference whether its there or not, but having it there confuses things when the actual goal was to side-step the assertion in the default case.
2017-06-12Add `EndRegion` statement kind to MIR.Felix S. Klock II-0/+9
* Emit `EndRegion` for every code-extent for which we observe a borrow. To do this, we needed to thread source info back through to `fn in_scope`, which makes this commit a bit more painful than one might have expected. * There is `end_region` emission in `Builder::pop_scope` and in `Builder::exit_scope`; the first handles falling out of a scope normally, the second handles e.g. `break`. * Remove `EndRegion` statements during the erase_regions mir transformation. * Preallocate the terminator block, and throw an `Unreachable` marker on it from the outset. Then overwrite that Terminator as necessary on demand. * Instead of marking the scope as needs_cleanup after seeing a borrow, just treat every scope in the chain as being part of the diverge_block (after any *one* of them has separately signalled that it needs cleanup, e.g. due to having a destructor to run). * Allow for resume terminators to be patched when looking up drop flags. (In particular, `MirPatch::new` has an explicit code path, presumably previously unreachable, that patches up such resume terminators.) * Make `Scope` implement `Debug` trait. * Expanded a stray comment: we do not emit StorageDead on diverging paths, but that end behavior might not be desirable.
2017-06-10rustc: make InferCtxt optional in MemCategorizationContext.Eduard-Mihai Burtescu-4/+2
2017-06-10rustc: do not depend on infcx.tables in MemCategorizationContext.Eduard-Mihai Burtescu-8/+7
2017-06-03Auto merge of #42396 - venkatagiri:remove_lifetime_extn, r=arielb1bors-12/+1
rustc: remove temporary lifetime extension by borrow hint closes #39283. Thanks to @nikomatsakis for mentoring on this one. r? @arielb1
2017-06-02rustc: remove temporary lifetime extension by borrow hintVenkata Giri Reddy-12/+1
2017-06-01strip param-env from infcxNiko Matsakis-7/+10
2017-06-01rustc: avoid using MethodCallee's signature where possible.Eduard-Mihai Burtescu-9/+9
2017-06-01rustc: remove unused field of mc::Categorization::Deref.Eduard-Mihai Burtescu-19/+19
2017-05-31Rollup merge of #42196 - tommyip:explain_closure_err, r=nikomatsakisMark Simulacrum-5/+9
Explain why a closure is `FnOnce` in closure errors. Issue: #42065 @nikomatsakis Am I going the right direction with this? ~~I am stuck in a few bits:~~ ~~1. How to trace the code to get the upvar instead of the original variable's span?~~ ~~2. How to find the node id of the upvar where the move occured?~~
2017-05-31Update closure errors to use `span_note`Tommy Ip-4/+5
2017-05-30Explain why closure is moved in error messageTommy Ip-8/+8
2017-05-29Auto merge of #42264 - GuillaumeGomez:new-error-codes, r=Susurrusbors-12/+67
New error codes Part of #42229.
2017-05-28Auto merge of #41917 - arielb1:mir-array, r=nagisabors-9/+9
Translate array drop glue using MIR I was a bit lazy here and used a usize-based index instead of a pointer iteration. Do you think this is important @eddyb? r? @eddyb
2017-05-28fix RUST_LOG ICE caused by printing a default impl's DefIdAriel Ben-Yehuda-1/+1
2017-05-28add NullOp::SizeOf and BinOp::OffsetAriel Ben-Yehuda-1/+2
2017-05-28address review commentsAriel Ben-Yehuda-7/+6
2017-05-27Add new error codesGuillaume Gomez-12/+67
2017-05-24Remove all instances of fragment_infos and fragment setsPaul Faria-568/+0
2017-05-24Explain why a closure is `FnOnce` in closure errorsTommy Ip-0/+3
2017-05-22rename `parameter_environment` to `param_env`Niko Matsakis-3/+3
2017-05-22use `ParamEnv` from `ty` rather than importingNiko Matsakis-5/+5
2017-05-22rename `ParameterEnvironment` to `ParamEnv`Niko Matsakis-10/+10
2017-05-22centralize the caching for is-copy, is-sized, and is-freezeNiko Matsakis-11/+12
Use the trait-environment+type as the key. Note that these are only invoked on types that live for the entire compilation (no inference artifacts). We no longer need the various special-case bits and caches that were in place before.
2017-05-18Add help message if a FnOnce is movedGuillaume Gomez-7/+24
2017-05-13rustc: stop interning CodeExtent, it's small enough.Eduard-Mihai Burtescu-19/+19
2017-05-13rustc: treat ReEarlyBound as free without replacing it with ReFree.Eduard-Mihai Burtescu-1/+6
2017-05-13rustc: use DefId instead of CodeExtent for FreeRegion's scope.Eduard-Mihai Burtescu-1/+3
2017-05-13rustc: uniformly compute ParameterEnvironment's "free outlive scope".Eduard-Mihai Burtescu-2/+2
2017-05-13Auto merge of #41847 - alexcrichton:less-unstable-annotations, r=eddybbors-3/+5
rustc: Add a new `-Z force-unstable-if-unmarked` flag This commit adds a new `-Z` flag to the compiler for use when bootstrapping the compiler itself. We want to be able to use crates.io crates, but we also want the usage of such crates to be as ergonomic as possible! To that end compiler crates are a little tricky in that the crates.io crates are not annotated as unstable, nor do they expect to pull in unstable dependencies. To cover all these situations it's intended that the compiler will forever now bootstrap with `-Z force-unstable-if-unmarked`. This flags serves a dual purpose of forcing crates.io crates to themselves be unstable while also allowing them to use other "unstable" crates.io crates. This should mean that adding a dependency to compiler no longer requires upstream modification with unstable/staged_api attributes for inclusion!
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+5
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-12box large variants in MIRAriel Ben-Yehuda-2/+2
Operand: 72 -> 24 B Statement: 192 -> 96 B Terminator: 256 -> 112 B librustc translation memory usage: 1795 -> 1669 MB next step would be interning lvalues, I suppose?
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-61/+61
2017-05-05Rollup merge of #41064 - Gankro:ptr-redux, r=alexcrichtonCorey Farwell-1/+1
refactor NonZero, Shared, and Unique APIs Major difference is that I removed Deref impls, as apparently LLVM has trouble maintaining metadata with a `&ptr -> &ptr` API. This was cited as a blocker for ever stabilizing this API. It wasn't that ergonomic anyway. * Added `get` to NonZero to replace Deref impl * Added `ptr` getter to Shared/Unique to replace Deref impl * Added Unique's `get` and `get_mut` conveniences to Shared * Deprecated `as_mut_ptr` on Shared in favour of `ptr` Note that Shared used to primarily expose only `*const` but there isn't a good justification for that, so I made it `*mut`.
2017-05-04fallout from NonZero/Unique/Shared changesAlexis Beingessner-1/+1