about summary refs log tree commit diff
path: root/src/librustc_borrowck
AgeCommit message (Collapse)AuthorLines
2016-09-03Address comments and add requested testsVadim Petrochenkov-6/+7
2016-09-03Support unions in borrow checkerVadim Petrochenkov-8/+88
Add some more tests
2016-09-03Some better support for unions through the compilerVadim Petrochenkov-5/+8
2016-09-02Rollup merge of #36171 - jonathandturner:temporary_value, r=nikomatsakisJonathan Turner-8/+14
Update lifetime errors to specifically note temporaries This PR updates the error message we give in the case of a temporary value not living long enough. Before: <img width="497" alt="screen shot 2016-08-31 at 10 02 47 am" src="https://cloud.githubusercontent.com/assets/547158/18138551/27a06794-6f62-11e6-9ee2-bdf8bed75ca7.png"> Now: <img width="488" alt="screen shot 2016-08-31 at 10 03 01 am" src="https://cloud.githubusercontent.com/assets/547158/18138557/2e5cf322-6f62-11e6-9047-4a78abf3d78c.png"> Specifically, it makes the following changes: * Detects if a temporary is being used. If so, it changes the labels to mention that a temporary value specifically is in question * Simplifies wording of the existing labels to focus on lifetimes rather than values being valid * Changes the help to a note, since the help+span wasn't as helpful (and sometimes more confusing) than just a note. r? @nikomatsakis
2016-08-31Update error message for lifetime of borrowed valuesJonathan Turner-8/+14
2016-08-28Rollup merge of #35917 - jseyfried:remove_attr_ext_traits, r=nrcJeffrey Seyfried-5/+0
syntax: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`
2016-08-28Rollup merge of #35850 - SergioBenitez:master, r=nrcJeffrey Seyfried-3/+4
Implement RFC#1559: allow all literals in attributes Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-27Rollup merge of #35657 - ahmedcharles:e0389, r=jonathandturnerJonathan Turner-2/+4
Update E0389 to the new format. #35630
2016-08-27Auto merge of #36030 - Manishearth:rollup, r=Manishearthbors-40/+45
Rollup of 7 pull requests - Successful merges: #35124, #35877, #35953, #36002, #36004, #36005, #36014 - Failed merges:
2016-08-27Rollup merge of #36004 - petrochenkov:hashloan, r=arielb1Manish Goregaokar-5/+9
rustc_borrowck: Don't hash types in loan paths 1) Types for equal loan paths are not always equal, they can sometimes differ in lifetimes, making equal loan paths hash differently. Example: https://github.com/rust-lang/rust/blob/71bdeea561355ba5adbc9a1f44f4f866a75a15c4/src/libcollections/linked_list.rs#L835-L856 One of `self.list`s has type ``` &ReFree(CodeExtent(15013/CallSiteScope { fn_id: 18907, body_id: 18912 }), BrNamed(0:DefIndex(3066), 'a(397), WontChange)) mut linked_list::LinkedList<T> ``` and other has type ``` &ReScope(CodeExtent(15018/Remainder(BlockRemainder { block: 18912, first_statement_index: 0 }))) mut linked_list::LinkedList<T> ``` (... but I'm not sure it's not a bug actually.) 2) Not hashing types is faster than hashing types. r? @arielb1
2016-08-26Auto merge of #35542 - scottcarr:visitor_refactor, r=nikomatsakisbors-55/+38
[MIR] track Location in MirVisitor, combine Location All the users of MirVisitor::visit_statement implement their own statement index tracking. This PR move the tracking into MirVisitor itself. Also, there were 2 separate implementations of Location that were identical. This PR eliminates one of them.
2016-08-27rustc: use Vec<Kind> in Substs, where Kind is a &TyS | &Region tagged pointer.Eduard Burtescu-2/+3
2016-08-27rustc: pass ty::Region behind an interned 'tcx reference.Eduard Burtescu-33/+33
2016-08-26rustc_borrowck: Don't hash types in loan pathsVadim Petrochenkov-5/+9
2016-08-25Refactor away `AttrMetaMethods`.Jeffrey Seyfried-5/+0
2016-08-25Refactor away `AttrNestedMetaItemMethods`.Jeffrey Seyfried-1/+1
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-3/+4
2016-08-22Update E0389 to the new format. #35630Ahmed Charles-2/+4
2016-08-22Rollup merge of #35817 - wesleywiser:fix_35703, r=jonathandturnerJonathan Turner-1/+4
Update E0503 to the new format Fixes #35703 Part of #35233 r? @jonathandturner
2016-08-22Rollup merge of #35360 - medzin:E0388, r=jonathandturnerJonathan Turner-2/+4
Updated error message E0388 Fixes #35339 as part of #35233. r? @GuillaumeGomez
2016-08-22Updated error message E0388Adam Medziński-2/+4
2016-08-20Update E0503 to the new formatWesley Wiser-1/+4
Fixes #35703 Part of #35233
2016-08-18port to new LocationScott A Carr-1/+1
2016-08-18track Location in visitor, combine LocationScott A Carr-54/+37
2016-08-18Auto merge of #35732 - jonathandturner:region_error_labels, r=nikomatsakisbors-16/+78
Move 'doesn't live long enough' errors to labels This patch moves the "doesn't live long enough" region-style errors to instead use labels. An example follows. Before: ``` error: `x` does not live long enough --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18 | 26 | let y = &x; | ^ | note: reference must be valid for the block at 23:10... --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:23:11 | 23 | fn main() { | ^ note: ...but borrowed value is only valid for the block suffix following statement 0 at 25:18 --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:25:19 | 25 | let x = 1; | ^ ``` After: ``` error: `x` does not live long enough --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18 | 26 | let y = &x; | ^ does not live long enough ... 32 | }; | - borrowed value only valid until here ... 35 | } | - borrowed value must be valid until here ``` r? @nikomatsakis
2016-08-17Fix tidy and nitsJonathan Turner-7/+9
2016-08-17Move 'doesn't live long enough' errors to labelsJonathan Turner-17/+77
2016-08-17rustc: remove ParamSpace from Substs.Eduard Burtescu-1/+1
2016-08-17rustc: remove SelfSpace from ParamSpace.Eduard Burtescu-4/+2
2016-08-17rustc: reduce Substs and Generics to a simple immutable API.Eduard Burtescu-3/+2
2016-08-16Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakisbors-15/+8
Implement the `!` type This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-14[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.Eduard Burtescu-0/+8
2016-08-13Remove obsolete divergence related stuffAndrew Cann-15/+8
Replace FnOutput with Ty Replace FnConverging(ty) with ty Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13Auto merge of #35348 - scottcarr:discriminant2, r=nikomatsakisbors-0/+13
[MIR] Add explicit SetDiscriminant StatementKind for deaggregating enums cc #35186 To deaggregate enums, we need to be able to explicitly set the discriminant. This PR implements a new StatementKind that does that. I think some of the places that have `panics!` now could maybe do something smarter.
2016-08-12Auto merge of #35431 - GuillaumeGomez:err_codes, r=jonathandturnerbors-109/+133
Err codes r? @jonathandturner
2016-08-11Auto merge of #35592 - jonathandturner:rollup, r=jonathandturnerbors-4/+8
Rollup of 23 pull requests - Successful merges: #35279, #35331, #35358, #35375, #35445, #35448, #35482, #35486, #35505, #35528, #35530, #35532, #35536, #35537, #35541, #35552, #35554, #35555, #35557, #35562, #35565, #35569, #35576 - Failed merges: #35395, #35415, #35563
2016-08-11add SetDiscriminant StatementKind to enable deaggregation of enumsScott A Carr-0/+13
2016-08-11Rollup merge of #35552 - theypsilon:master, r=jonathandturnerJonathan Turner-4/+8
Update error message E0384 to new format Part of #35233 Fixes #35184 r? @jonathandturner
2016-08-11Auto merge of #35403 - scottcarr:lvalue_refactor, r=nikomatsakisbors-6/+6
refactor lvalue_ty to be method of lvalue Currently `Mir` (and `MirContext`) implement a method `lvalue_ty` (and actually many more `foo_ty`). But this should be a method of `Lvalue`. If you have an `lvalue` and you want to get its type, the natural thing to write is: ``` lvalue.ty() ``` Of course it needs context, but still: ``` lvalue.ty(mir, tcx) ``` Makes more sense than ``` mir.lvalue_ty(lvalue, tcx) ``` I actually think we should go a step farther and have traits so we could get the type of some value generically, but that's up for debate. The thing I'm running into a lot in the compiler is I have a value of type `Foo` and I know that there is some related type `Bar` which I can get through some combination of method calls, but it's often not as direct as I would imagine. Unless you already know the code, its not clear why you would look in `Mir` for a method to get the type of an `Lvalue`.
2016-08-10Update error message E0384 to new formatJosé manuel Barroso Galindo-4/+8
Part of #35233 Fixes #35184
2016-08-09Auto merge of #35166 - nikomatsakis:incr-comp-ice-34991-2, r=mwbors-1/+3
Address ICEs running w/ incremental compilation and building glium Fixes for various ICEs I encountered trying to build glium with incremental compilation enabled. Building glium now works. Of the 4 ICEs, I have test cases for 3 of them -- I didn't isolate a test for the last commit and kind of want to go do other things -- most notably, figuring out why incremental isn't saving much *effort*. But if it seems worthwhile and I can come back and try to narrow down the problem. r? @michaelwoerister Fixes #34991 Fixes #32015
2016-08-08track MIR through the dep-graphNiko Matsakis-1/+3
Per the discussion on #34765, we make one `DepNode::Mir` variant and use it to represent both the MIR tracking map as well as passes that operate on MIR. We also track loads of cached MIR (which naturally comes from metadata). Note that the "HAIR" pass adds a read of TypeckItemBody because it uses a myriad of tables that are not individually tracked.
2016-08-07Update librustc_borrowck error codes checkGuillaume Gomez-108/+109
2016-08-06Add E0388 error explanationGuillaume Gomez-1/+24
2016-08-05refactor lvalue_ty to be method of lvalueScott A Carr-6/+6
2016-08-05Update error format for E0373trixnz-1/+4
2016-07-29intravisit: Fold functionality of IdVisitor into the regular Visitor.Michael Woerister-1/+1
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-5/+2
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-06-27Fix `Cargo.toml`sJeffrey Seyfried-0/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-16/+19