815 Commits

Author SHA1 Message Date
Donato Sciarra
82607d2cf3 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
Matthias Krüger
71120ef1e5 Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
Masaki Hara
e2b95cb70e Lift some Sized checks. 2018-08-19 08:07:33 +09:00
Matthew Jasper
3c8eb4eac4 Name the right expected and actual return lifetimes 2018-08-14 20:35:47 +01:00
Matthew Jasper
372e4aee1d Tweek best_blame_constraint to slightly prefer specific explanations 2018-08-14 20:35:46 +01:00
Matthew Jasper
7710d959f4 Change "return" to "returning this value" when explaining free regions 2018-08-14 20:35:46 +01:00
Matthew Jasper
74ce76a009 Treat assigning the destination of a call as an assignment 2018-08-14 20:35:46 +01:00
Matthew Jasper
092f03a07a Make assigning to the return type interesting 2018-08-14 20:35:46 +01:00
bors
0aa8d03202 Auto merge of #53177 - nikomatsakis:nll-redundant-borrows-and-escaping-values, r=pnkfelix
optimize redundant borrows and escaping paths in NLL

This builds on https://github.com/rust-lang/rust/pull/53168 and adds a commit that addresses https://github.com/rust-lang/rust/issues/53176 -- or at least I think it does. I marked this as WIP because I want to see the test results (and measure the performance). I also want to double check we're not adding in any unsoundness here.
2018-08-10 19:18:22 +00:00
Niko Matsakis
ff7f6d57de don't walk MIR if no local variables need liveness
This is true for tuple-stress and html5ever
2018-08-10 04:17:46 -04:00
David Wood
255ead5faa
Fallback to 'has type' error messages rather than 'lifetime appears in type'. 2018-08-09 10:25:26 +02:00
David Wood
82b48277a2
Correctly identify named early bound regions. 2018-08-09 10:25:23 +02:00
bors
80caa7f9f4 Auto merge of #53186 - mikhail-m1:master, r=nikomatsakis
Fixes #53119.

Fixes #53119.

I minimized sample little bit more, but I checked the sample from issue too.
r? @nikomatsakis
2018-08-08 23:30:12 +00:00
Niko Matsakis
e5f32effa9
add comment 2018-08-08 14:36:40 -04:00
bors
63fe441db8 Auto merge of #53088 - matthewjasper:closure-region-spans, r=nikomatsakis
[NLL] Use span of the closure args in free region errors

Also adds a note when one of the free regions is BrEnv.
In a future PR I'll change these messages to say "return requires", which should improve them a bit more.

r? @nikomatsakis
2018-08-08 12:48:32 +00:00
Mikhail Modin
ffe336d07b Fixes #53119. 2018-08-08 08:02:47 +01:00
Niko Matsakis
3b7989d1df avoid computing liveness when a variable doesn't need it
In particular, we skip computing liveness for a variable X if all the
regions in its type are known to outlive free regions.
2018-08-07 15:05:16 -04:00
Niko Matsakis
887296e8c3 make it possible to customize the RegionGraph direction 2018-08-07 14:52:59 -04:00
Niko Matsakis
a92bf8dd29 liveness_map: rustfmt 2018-08-07 14:52:59 -04:00
Niko Matsakis
d1ce8e846b move liveness_map into the liveness module 2018-08-07 14:52:59 -04:00
Niko Matsakis
5147d383d3 promote liveness to a directory module 2018-08-07 14:52:59 -04:00
Niko Matsakis
db7a07cfc6 update comment to more accurately describe the limitations 2018-08-07 14:52:59 -04:00
Niko Matsakis
fb1702f301 compute liveness later 2018-08-07 14:52:59 -04:00
bors
ccb550fb45 Auto merge of #53109 - nikomatsakis:nll-escaping-into-return-revert, r=nikomatsakis
revert #52991

Reverts https://github.com/rust-lang/rust/pull/52991 which is flawed. I have an idea how to fix it but might as well revert first since it is so wildly flawed. That's what I get for opening PRs while on PTO =)

r? @pnkfelix
2018-08-07 16:01:27 +00:00
Matthew Jasper
b13e3f8770 Name return type in free region messages 2018-08-06 21:42:26 +01:00
David Wood
37ba9ca334
Disable some nice region errors in NLL mode. 2018-08-06 20:43:16 +02:00
Niko Matsakis
67c96edce6 revert #52991 2018-08-06 09:00:08 -04:00
Matthew Jasper
f72b8a44c5 Use span of the closure args in free region errors 2018-08-05 14:33:38 +01:00
bors
9f9ac89d11 Auto merge of #52959 - matthewjasper:closure-spans, r=pnkfelix
[NLL] Use smaller spans for errors involving closure captures

Closes #51170
Closes #46599

Error messages involving closures now point to the captured variable/closure args.

r? @pnkfelix
2018-08-05 09:17:24 +00:00
bors
b47c314c56 Auto merge of #52991 - nikomatsakis:nll-escaping-into-return, r=pnkfelix
avoid computing liveness for locals that escape into statics

Fixes #52713

I poked at this on the plane and I think it's working -- but I want to do a bit more investigation and double check. The idea is to identify those local variables where the entire value will "escape" into the return -- for them, we don't need to compute liveness, since we know that the outlives relations from the return type will force those regions to be equal to free regions. This should help with html5ever in particular.

- [x] test performance
- [x] verify correctness
- [x] add comments

r? @pnkfelix
cc @lqd
2018-08-05 07:06:11 +00:00
Niko Matsakis
2e2ea26a83 remove unused tcx argument 2018-08-05 07:42:18 +02:00
Niko Matsakis
5e2f337e6b more comments and justify correctness 2018-08-04 09:30:24 +02:00
Niko Matsakis
936fa6f67f generalize the Deref case and simplify the code 2018-08-04 09:26:30 +02:00
Niko Matsakis
e7d8d651d5 add a comment explaining the idea 2018-08-04 09:26:20 +02:00
Matthew Jasper
903851f785 Highlight closure spans for borrow and initialization errors 2018-08-03 23:00:27 +01:00
bors
7e031b0907 Auto merge of #52973 - davidtwco:issue-52663-lifetimes-not-included-in-span, r=pnkfelix
NLL mentions lifetimes that are not included in printed span(s).

Part of #52663.

r? @pnkfelix
2018-08-03 17:46:13 +00:00
Niko Matsakis
e79656c5b7 support X = &*Y reborrows 2018-08-03 08:15:55 +02:00
Niko Matsakis
341a07c4c3 compute union-find of locals flowing into the output of statics
Co-authored-by: lqd <remy.rakic+github@gmail.com>
Co-authored-by: nikomatsakis <niko@alum.mit.edu>
2018-08-02 22:02:59 +03:00
David Wood
2488cb6b10
Explicitly label any named lifetimes mentioned in error messages. 2018-08-02 12:00:15 +02:00
David Wood
1863cb7372
Errors are more specific in cases where borrows are used in future iterations of loops. 2018-08-01 17:42:15 +02:00
Niko Matsakis
b9652aee65 region_infer: rustfmt, pacifying the mercilous tidy 2018-07-31 02:31:41 +02:00
Niko Matsakis
68c2a39a72 free RegionBoundPairs earlier and avoid normalizing twice
Normalization results are memoized, so this may not be worth it, but it
seems easy enough to do.
2018-07-31 02:31:41 +02:00
Niko Matsakis
490928f709 remove region_bound_pairs from FRR as they are not needed later 2018-07-31 02:31:41 +02:00
Niko Matsakis
1e1f18ddba make a free fn for creating the URR 2018-07-31 02:31:41 +02:00
Niko Matsakis
d1e67fcacd remove universal-region-relation computation from universal_regions 2018-07-31 02:31:40 +02:00
Niko Matsakis
3bca170bc7 introduce, but do not use, free_region_relation computation
This duplicates, effectively, existing code in the universal regions
computation.
2018-07-31 02:26:06 +02:00
bors
e4378412ec Auto merge of #52830 - matthewjasper:bootstrap-prep, r=matthewjasper
[NLL] Fix some things for bootstrap

Some changes that are required when bootstrapping rustc with NLL enabled.

* Remove a bunch of unused `mut`s that aren't needed, but the existing lint doesn't catch.
* Rewrite a function call to satisfy NLL borrowck. Note that the borrow is two-phase, but gets activated immediately by an unsizing coercion.

cc #51823
2018-07-30 10:19:38 +00:00
bors
7bbcd005b3 Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkov
Don't format!() string literals

Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-30 06:29:39 +00:00
Matthew Jasper
503455bcc7 Remove unused muts 2018-07-29 18:04:09 +01:00
bors
75af9df71b Auto merge of #52620 - mikhail-m1:51351, r=nikomatsakis
fix simple case of issue #51351 and #52133

r? @nikomatsakis
2018-07-29 13:23:01 +00:00