267 Commits

Author SHA1 Message Date
Felix S. Klock II
a771b0f075 Work around rust-lang/rust#49998 with experimental code that does less updating of cause map.
This seems to avoid poor scaling on src/test/ui/span/dropck_vec_cycle_checked.rs
2018-04-18 15:37:30 +02:00
bors
881a7cd86e Auto merge of #49836 - nikomatsakis:nll-facts-prep, r=pnkfelix
prep work for using timely dataflow with NLL

Two major changes:

**Two-phase borrows are overhauled.** We no longer have two bits per borrow. Instead, we track -- for each borrow -- an (optional) "activation point". Then, for each point P where the borrow is in scope, we check where P falls relative to the activation point. If P is between the reservation point and the activation point, then this is the "reservation" phase of the borrow, else the borrow is considered active. This is simpler and means that the dataflow doesn't have to care about 2-phase at all, at last not yet.

**We no longer support using the MIR borrow checker without NLL.** It is going to be increasingly untenable to support lexical mode as we go forward, I think, and also of increasingly little value. This also exposed a few bugs in NLL mode due to increased testing.

r? @pnkfelix
cc @bobtwinkles
2018-04-17 14:23:57 +00:00
kennytm
bf16e4bc54
Rollup merge of #49647 - kennytm:duplicated-features, r=aturon
Remove `underscore_lifetimes` and `match_default_bindings` from active feature list

These are already stabilized in 1.26.
2018-04-17 03:34:55 +08:00
kennytm
73ea8939ee
Rollup merge of #49931 - csmoe:end_span, r=estebank
Fix incorrect span in `&mut` suggestion

Fixes #49859
2018-04-17 03:34:30 +08:00
bors
49317cd511 Auto merge of #49130 - smmalis37:range, r=alexcrichton
Move Range*::contains to a single default impl on RangeBounds

Per the ongoing discussion in #32311.

This is my first PR to Rust (woo!), so I don't know if this requires an amendment to the original range_contains RFC, or not, or if we can just do a psuedo-RFC here. While this may no longer follow the explicit decision made in that RFC, I believe this better follows its spirit by adding the new contains method to all Ranges. It also allows users to be generic over all ranges and use this method without writing it themselves (my personal desired use case).

This also somewhat answers the unanswered question about Wrapping ranges in the above issue by instead just punting it to the question of what those types should return for start() & end(), or if they should implement RangeArgument at all. Those types could also implement their own contains method without implementing this trait, in which case the question remains the same.

This does add a new contains method to types that already implemented RangeArgument but not contains. These types are RangeFull, (Bound<T>, Bound<T>), (Bound<&'a T>, Bound<&'a T>). No tests have been added for these types yet. No inherent method has been added either.

r? @alexcrichton
2018-04-16 16:07:10 +00:00
Niko Matsakis
96dba9358c s/use_mir/use_mir_borrowck/ 2018-04-15 07:13:44 -04:00
Niko Matsakis
45d281d7fa remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
Niko Matsakis
818ae6fece don't expose the borrows field 2018-04-15 07:06:30 -04:00
Niko Matsakis
033c4f2e3c just use an iterator 2018-04-15 07:06:30 -04:00
Niko Matsakis
df233f0f2c stop using borrows for anything but iterating over live data 2018-04-15 07:06:30 -04:00
Niko Matsakis
d4005a2bc9 thread borrow-set around more 2018-04-15 07:06:30 -04:00
Niko Matsakis
a849da626d remove ReserveOrActivateIndex 2018-04-15 07:06:29 -04:00
Niko Matsakis
d32e5aac3d use the activations_at_location map to check activations
Not gen bits
2018-04-15 07:06:29 -04:00
Niko Matsakis
e1f82aa590 determine whether a borrow is active based solely on the location 2018-04-15 07:06:29 -04:00
Niko Matsakis
f93d5d30bd add useful debug 2018-04-15 07:06:29 -04:00
Niko Matsakis
8e783da222 encapsulate ReserveOrActivateIndex into the borrows dataflow 2018-04-15 07:06:29 -04:00
Niko Matsakis
5f7b74f832 construct the BorrowSet outside of borrows 2018-04-15 07:06:29 -04:00
Niko Matsakis
e1123674b1 extract code to build borrow-set into borrow_check::borrow_set
Also:

- Extract common helper functions into a helper trait.
- Kill a bit of dead code.
2018-04-15 07:06:29 -04:00
Niko Matsakis
70592664b6 relocate BorrowData etc into borrow_check::borrow_set 2018-04-15 07:06:27 -04:00
bors
602b3957f1 Auto merge of #49885 - spastorino:fn_ref_unsound, r=nikomatsakis
Fix unsoundness bug in functions input references

Fixes #48803

r? @nikomatsakis
2018-04-15 09:14:43 +00:00
csmoe
6f5a16bf1e fix error span 2018-04-14 11:04:39 +08:00
bors
9c2bfcbea2 Auto merge of #49808 - spastorino:dump_cause_ice, r=nikomatsakis
[NLL] Fix ICE when a borrow wrapped in a temporary is used after dropped

Fixes #47646

r? @nikomatsakis
2018-04-13 16:06:14 +00:00
Santiago Pastorino
55fb12c274
Fix unsoundness bug in functions input references
Check that function input references are well formed
2018-04-11 20:02:14 -03:00
Santiago Pastorino
0e2e179571
Make prove_predicates take an Iterator 2018-04-11 20:02:14 -03:00
Santiago Pastorino
9ec7aa256a
Run rustfmt over type_check/mod.rs 2018-04-11 20:02:14 -03:00
Scott McMurray
c4b6521327 Add ok-wrapping to catch blocks, per RFC 2018-04-10 20:03:40 -07:00
bors
0b72d48f8e Auto merge of #48914 - gaurikholkar:e0389, r=nikomatsakis
Modify compile-fail/E0389 error message WIP

This fixes #47388

cc @nikomatsakis @estebank

r? @nikomatsakis

Certain ui tests were failing locally. I'll check if the same happens here too.
2018-04-10 19:00:19 +00:00
Santiago Pastorino
2c79f6458e
rustfmt explain_borrow/mod 2018-04-09 17:35:32 -03:00
Santiago Pastorino
2e87dbbde1
Fix ICE when a borrow is used after drop
ht @nickfrostatx for the first initial patch
2018-04-09 17:35:28 -03:00
gaurikholkar
c792d1e0c1 tidy fixes 2018-04-09 23:12:13 +05:30
gaurikholkar
2ad20e8127 tidy fixes 2018-04-08 22:57:48 +05:30
Steven Malis
f5a367c7bb Update based on RangeBounds trait being moved to libcore. 2018-04-07 15:47:18 -07:00
gaurikholkar
cbde62c2cc fix tidy errors 2018-04-07 14:36:29 +05:30
gaurikholkar
e5a96a4b95 modify the error message- CR Comments 2018-04-07 13:17:16 +05:30
bors
0e35dddbd3 Auto merge of #49392 - retep007:nll-issue-48962, r=nikomatsakis
fixes move analysis

Fixed compiler error by correct checking when dereferencing

Fix #48962

r? @nikomatsakis
2018-04-06 21:50:12 +00:00
gaurikholkar
6686d104c8 tidy fix 2018-04-06 20:28:00 +05:30
gaurikholkar
1fb25fbbe3 reduce nested loops in the code 2018-04-06 20:00:21 +05:30
gaurikholkar
12d141561d tidy fixes 2018-04-05 22:49:09 +05:30
gaurikholkar
1b06fe1ef5 Merge branch 'master' of https://github.com/rust-lang/rust into e0389 2018-04-05 21:52:40 +05:30
gaurikholkar
6c649fbed4 address code review comments 2018-04-05 21:48:06 +05:30
Peter Hrvola
9056c7a849 Fixed error message from PR review #49392 2018-04-02 09:01:58 +02:00
Peter Hrvola
dc41851882 Fixed nits from PR review #49392 2018-04-01 10:01:51 +02:00
bors
3c5f850958 Auto merge of #49472 - nikomatsakis:nll-optimize-constraint-prop-1, r=pnkfelix
optimize NLL constraint propagation a little

Removes a bone-headed hot spot in NLL constant propagation; we were re-allocating the stack vector and hashmap as we repeated the DFS. This change shares those resources across each call.

It also modifies the constraint list to be a linked list; arguably I should revert that, though, as this didn't turn out to be a perf hit and perhaps the old code was clearer? (Still, the new style appeals to me.)

r? @pnkfelix
2018-03-31 04:09:43 +00:00
Niko Matsakis
ca8176d778 apply pnkfelix nits 2018-03-29 13:32:12 -04:00
Niko Matsakis
bd90302af6 document reason for #[inline(never)] annotation 2018-03-29 13:32:12 -04:00
Niko Matsakis
499d784fbd amortize dfs storage creation 2018-03-29 13:32:12 -04:00
Niko Matsakis
96f3e560d9 remove dependency map and instead use a linked list of constraints 2018-03-29 13:32:12 -04:00
Niko Matsakis
1ef1b92379 add #[inline(never)] annotations 2018-03-29 03:44:00 -04:00
bors
9c9424de51 Auto merge of #49202 - csmoe:trait_engine, r=nikomatsakis
Introduce trait engine

address #48895 step 1: introduce trait engine
2018-03-27 14:31:43 +00:00
Peter Hrvola
4954e3e828 fixes internal compiler error:
librustc_mir/transform/elaborate_drops.rs — drop of untracked, uninitialized value

Fix #48962

r? @nikomatsakis
2018-03-26 22:07:40 +02:00