about summary refs log tree commit diff
path: root/src/librustc_borrowck
AgeCommit message (Collapse)AuthorLines
2017-09-01rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree.Eduard-Mihai Burtescu-52/+52
2017-09-01rustc: use hir::ItemLocalId instead of ast::NodeId in CodeExtent.Eduard-Mihai Burtescu-45/+33
2017-09-01rustc: take TyCtxt and RegionMaps in CodeMap::span.Eduard-Mihai Burtescu-8/+5
2017-09-01rustc: use hir::ItemLocalId instead of ast::NodeId in CFG.Eduard-Mihai Burtescu-74/+87
2017-08-28Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-6/+0
2017-08-27Move unused-extern-crate to late passTatsuyuki Ishi-3/+0
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-13/+12
2017-08-22Rollup merge of #43993 - tamird:better-wording-error, r=arielb1Guillaume Gomez-13/+12
borrowck: name the correct type in error message Closes #36407. r? @Mark-Simulacrum
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-14/+2
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-93/+1
2017-08-21Auto merge of #43971 - alexcrichton:lint-statements, r=michaelwoeristerbors-14/+2
rustc: Add `Local` to the HIR map of parents When walking parents for lints we want to be sure to hit `let` statements which can have attributes, so hook up these statements in the HIR map. Closes #43910
2017-08-20borrowck: name the correct type in error messageTamir Duberstein-13/+12
Closes #36407.
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-97/+1
2017-08-18rustc: Add `Local` to the HIR map of parentsAlex Crichton-13/+1
When walking parents for lints we want to be sure to hit `let` statements which can have attributes, so hook up these statements in the HIR map. Closes #43910
2017-08-18Fix a diagnosticAlex Crichton-1/+1
2017-08-17rustc: Rename NodeLocal to NodeBindingAlex Crichton-1/+1
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-599/+53
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-40/+40
2017-08-16Move borrowck error msg construction to module in `rustc_mir` (for later ↵Felix S. Klock II-599/+53
reuse by mir borrowck). post-rebase: Do not put "(Ast)" suffix in error msg unless passed `-Z borrowck-mir`. (But unconditionally include "(Mir)" suffix for mir-borrowck errors.)
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-40/+40
Like #43008 (f668999), but _much more aggressive_.
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-17/+37
2017-08-14Auto merge of #43740 - michaelwoerister:local-id-in-typecktables, r=arielb1bors-16/+36
Use hir::ItemLocalId as keys in TypeckTables. This PR makes `TypeckTables` use `ItemLocalId` instead of `NodeId` as key. This is needed for incremental compilation -- for stable hashing and for being able to persist and reload these tables. The PR implements the most important part of https://github.com/rust-lang/rust/issues/40303. Some notes on the implementation: * The PR adds the `HirId` to HIR nodes where needed (`Expr`, `Local`, `Block`, `Pat`) which obviates the need to store a `NodeId -> HirId` mapping in crate metadata. Thanks @eddyb for the suggestion! In the future the `HirId` should completely replace the `NodeId` in HIR nodes. * Before something is read or stored in one of the various `TypeckTables` subtables, the entry's key is validated via the new `TypeckTables::validate_hir_id()` method. This makes sure that we are not mixing information from different items in a single table. That last part could be made a bit nicer by either (a) new-typing the table-key and making `validate_hir_id()` the only way to convert a `HirId` to the new-typed key, or (b) just encapsulate sub-table access a little better. This PR, however, contents itself with not making things significantly worse. Also, there's quite a bit of switching around between `NodeId`, `HirId`, and `DefIndex`. These conversions are cheap except for `HirId -> NodeId`, so if the valued reviewer finds such an instance in a performance critical place, please let me know. Ideally we convert more and more code from `NodeId` to `HirId` in the future so that there are no more `NodeId`s after HIR lowering anywhere. Then the amount of switching should be minimal again. r? @eddyb, maybe?
2017-08-14Fix some merge fallout.Michael Woerister-1/+2
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-11Encapsulate sub-table access in TypeckTables and validate keys on each access.Michael Woerister-5/+3
2017-08-11Use DefIndex instead of NodeId in UpvarId.Michael Woerister-11/+23
2017-08-11Use ItemLocalId as key for closure_tys and closure_kinds in TypeckTables.Michael Woerister-1/+3
2017-08-11Use ItemLocalId as key for TypeckTables::pat_binding_modes.Michael Woerister-2/+7
2017-08-11Use ItemLocalId as key for node_types, node_substs, and adjustments in ↵Michael Woerister-1/+3
TypeckTables.
2017-08-11Implement a cache for looking up yieldsJohn Kåre Alsaker-2/+2
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-13/+33
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-22/+70
2017-08-01Fixed formatting.Isaac van Bakel-2/+2
2017-08-01Fixed interior mutable references causing a markIsaac van Bakel-24/+31
The mutability system now checks where derefs go through borrows in the loan chain, and can correctly detect mutable borrows inside structs and tuples.
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-08-01Fixed refs being marked used mutably on mut derefIsaac van Bakel-0/+13
Boxes are the exception - since a Box is as mutable as its contents.
2017-07-31Auto merge of #43547 - arielb1:no-borrow-no-check, r=nikomatsakisbors-16/+46
borrowck: skip CFG construction when there is nothing to propagate CFG construction takes a large amount of time and memory, especially for large constants. If such a constant contains no actions on lvalues, it can't have borrowck problems and can be ignored by it. This removes the 4.9GB borrowck peak from #36799. It seems that HIR had grown by 300MB and MIR had grown by 500MB from the last massif collection and that remains to be investigated, but this at least shaves the borrowck peak. r? @nikomatsakis
2017-07-31Auto merge of #43399 - tschottdorf:bndmode-pat-adjustments, r=nikomatsakisbors-5/+6
default binding modes: add pat_binding_modes This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. It is a WIP because I wasn't able to avoid all uses of the binding modes as not all call sites are close enough to the typeck tables. I added marker comments to any line matching `BindByRef|BindByValue` so that reviewers are aware of all of them. I will look into changing the HIR (as suggested in [2]) to not carry a `BindingMode` unless one was explicitly specified, but this PR is good for a first round of comments. The actual changes are quite small and CI will fail due to overlong lines caused by the marker comments. See #42640. cc @nikomatsakis [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-31borrowck: skip CFG construction when there is nothing to propagateAriel Ben-Yehuda-16/+46
CFG construction takes a large amount of time and memory, especially for large constants. If such a constant contains no actions on lvalues, it can't have borrowck problems and can be ignored by it. This removes the 4.9GB borrowck peak from #36799. It seems that HIR had grown by 300MB and MIR had grown by 500MB from the last massif collection and that remains to be investigated, but this at least shaves the borrowck peak.
2017-07-30extended info for E0595 closure cannot mutate immutable local variableZack M. Davis-1/+18
2017-07-30default binding modes: add pat_binding_modesTobias Schottdorf-5/+6
This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. `pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and used wherever the HIR would be scraped prior to this PR. Unfortunately, one blemish, namely a two callers to `contains_explicit_ref_binding`, remains. This will likely have to be removed when the second part of [1], the `pat_adjustments` table, is tackled. Appropriate comments have been added. See #42640. [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-29Use a free error codeAlex Crichton-4/+4
2017-07-28Fix error message tests againJohn Kåre Alsaker-5/+5
2017-07-28Fix error message testsJohn Kåre Alsaker-0/+5
2017-07-28Fix error message testsJohn Kåre Alsaker-0/+5
2017-07-28Fix tidy errorsJohn Kåre Alsaker-1/+5
2017-07-28change how we report `err_out_of_scope` borrowck errorsNiko Matsakis-13/+165
Also, remove the explicit code detecting borrows over a yield. It turns out not to be necessary -- any such borrow winds up with a lifetime that is part of the generator type, and therefore which will outlive the generator expression itself, which yields an `err_out_of_scope`. So instead we intercept those errors and display them in a nicer way.
2017-07-28combine `bckerr_to_diag` and `note_and_explain_bckerr`Niko Matsakis-144/+137
2017-07-28Remove support for `gen arg`Alex Crichton-17/+0