Commit Graph

258 Commits

Author SHA1 Message Date
bors
785643a5eb Auto merge of #45668 - nikomatsakis:nll-free-region, r=arielb1
extend NLL with preliminary support for free regions on functions

This PR extends https://github.com/rust-lang/rust/pull/45538 with support for free regions. This is pretty preliminary and will no doubt want to change in various ways, particularly as we add support for closures, but it's enough to get the basic idea in place:

- We now create specific regions to represent each named lifetime declared on the function.
- Region values can contain references to these regions (represented for now as a `BTreeSet<RegionIndex>`).
- If we wind up trying to infer that `'a: 'b` must hold, but no such relationship was declared, we report an error.

It also does a number of drive-by refactorings.

r? @arielb1

cc @spastorino
2017-11-06 23:30:57 +00:00
Santiago Pastorino
f9bc8e7c4f Make DEBUG_FORMAT = custom work
Fixes #45763, ht by @durka
2017-11-04 19:10:44 -03:00
Niko Matsakis
3db1a95a3f add/fix various comments to BitMatrix
Notably, the (hitherto unused) `less_than` method was not at all what it
purported to be. It in fact computes the opposite.
2017-11-02 04:40:49 -04:00
Paul Daniel Faria
97692afda9 newindex_type macro: make index private by default and allow pub through config 2017-11-01 21:25:37 -04:00
Paul Daniel Faria
bf1198eb1f newtype_index: Support simpler serializable override, custom derive, and fix mir_opt tests 2017-11-01 20:12:53 -04:00
Paul Daniel Faria
b46e42fe2a Clean up macro argument matches so they satisfy tidy checks 2017-11-01 20:12:10 -04:00
Paul Daniel Faria
4e496de26d Add derive and doc comment capabilities to newtype_index macro 2017-11-01 20:12:10 -04:00
Niko Matsakis
f27eb1e684 change region display to '_#Nr, update the newtype_index! macro
The macro now takes a format string. It no longer defaults to using the
type name. Didn't seem worth going through contortions to maintain.  I
also changed most of the debug formats to be `foo[N]` instead of `fooN`.
2017-10-31 12:41:40 -04:00
Niko Matsakis
7523c7368c introduce liveness constraints into NLL code
And do a bunch of gratuitious refactoring that I did not bother to
separate into nice commits.
2017-10-31 12:41:38 -04:00
Michael Woerister
54818b3e99 Update some comments about StableHasher. 2017-10-26 11:10:07 +02:00
Michael Woerister
89909c76a3 Fix 32 vs 64 bit platform instability in StableHasher. 2017-10-25 16:49:55 +02:00
bors
c0956ff265 Auto merge of #45319 - michaelwoerister:use-128bit-siphash, r=nikomatsakis
incr.comp.: Use 128bit SipHash for fingerprinting

This PR switches incr. comp. result fingerprinting from 128 bit BLAKE2 to 128 bit SipHash. When we started using BLAKE2 for fingerprinting, the 128 bit version of SipHash was still experimental. Now that it isn't anymore we should be able to get a nice performance boost without significantly increasing collision probability.

~~I'm going to start a try-build for this, so we can gauge the performance impact before merging (hence the `WIP` in the title).~~

EDIT: Performance improvements look as expected. Tests seem to be passing.

Fixes #41215.
2017-10-20 07:50:18 +00:00
Santiago Pastorino
b8f981a149 Generate FirstStatementIndex using newtype_index macro 2017-10-17 12:06:20 -03:00
Michael Woerister
10e289e191 Make debuginfo::UniqueTypeId use 128 bit hash. 2017-10-16 14:44:40 +02:00
Michael Woerister
74ebad4b63 Use SipHasher128 in StableHasher. 2017-10-16 14:44:40 +02:00
Michael Woerister
25014b5379 rustc_data_structures: Add implementation of 128 bit SipHash. 2017-10-16 14:44:40 +02:00
kennytm
82f2c28bc8 Rollup merge of #45110 - Nashenas88:master, r=arielb1
Improve newtype_index macro to handle description and constants consistently
2017-10-13 23:37:53 +08:00
Paul Faria
97fe353ce6 Split lines longer than 100 columns 2017-10-11 20:06:24 -04:00
Paul Faria
9423bee6d3 Move const qualifier from brackets to constant values and remove comma from after identifier 2017-10-11 20:01:55 -04:00
kennytm
23a99f4e0e
Rollup merge of #44775 - MaloJaffre:debug-struct, r=sfackler
Refactor to use `debug_struct` in several Debug impls

Also use `pad` and derive `Debug` for `Edge`.

Fixes #44771.
2017-10-10 22:43:57 +08:00
Malo Jaffré
679457ad2a Refactor to use debug_struct in several Debug impls
Fixes #44771.
2017-10-09 20:09:08 +02:00
Paul Faria
35545b36cf Improve newtype_index macro to handle description and constants consistently 2017-10-08 15:20:28 -04:00
Santiago Pastorino
271a492cb2 Generate ScopeId using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
b5a5556dd4 Generate DepNodeIndexNew using newtype_index macro 2017-10-04 23:51:43 -03:00
Santiago Pastorino
3502bec032 Make newtype_index get debug_name using reflection 2017-10-04 23:50:53 -03:00
Santiago Pastorino
9af7426b47 Make newtype_index macro use full path to resolve constants 2017-10-04 23:50:53 -03:00
Santiago Pastorino
3d230af80b Move newtype_index to rustc_data_structures 2017-10-04 23:50:53 -03:00
Esteban Küber
ddee9fbc99 Point at parameter type on E0301
On "the parameter type `T` may not live long enough" error, point to the
parameter type suggesting lifetime bindings:

```
error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
27 | struct Foo<T> {
   |            - help: consider adding an explicit lifetime bound `T: 'static`...
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'static T` does not outlive the data it points at
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
```
2017-09-24 11:50:09 -07:00
Michael Woerister
9798a88e9e incr.comp.: Add some comments. 2017-09-20 11:34:28 +02:00
Michael Woerister
3b75a3dfea incr.comp.: Make sure traits_in_scope results are hashed in a stable way. 2017-09-20 11:21:25 +02:00
Michael Woerister
74d6b850fd incr.comp.: Fix rebase fallout. 2017-09-18 12:14:52 +02:00
Michael Woerister
67c84e05e7 incr.comp.: Use StableHash impls instead of functions for hashing most maps. 2017-09-18 11:27:10 +02:00
Michael Woerister
e3f913167c Fix issues uncovered by rebasing:
- Don't hash traits in scope as part of HIR hashing any more.
- Some queries returned DefIndexes from other crates.
- Provide a generic way of stably hashing maps (not used everywhere yet).
2017-09-18 11:25:34 +02:00
Michael Woerister
3cc3ae22bd incr.comp.: Move result fingerprinting to DepGraph::with_task().
This makes sure that we don't introduce strange cases where we have
nodes outside the query system that could break red/green tracking
and it will allow to keep red/green neatly encapsulated within the
DepGraph implementation.
2017-09-18 11:25:34 +02:00
Michael Woerister
e6c9a53d1a incr.comp.: Compute hashes of all query results. 2017-09-18 11:23:08 +02:00
Alex Crichton
a7817dd52c rustc: Preallocate when building the dep graph
This commit alters the `query` function in the dep graph module to preallocate
memory using `with_capacity` instead of relying on automatic growth. Discovered
in #44576 it was found that for the syntex_syntax clean incremental benchmark
the peak memory usage was found when the dep graph was being saved, particularly
the `DepGraphQuery` data structure itself. PRs like #44142 which add more
queries end up just making this much larger!

I didn't see an immediately obvious way to reduce the size of the
`DepGraphQuery` object, but it turns out that `with_capacity` helps quite a bit!
Locally 831 MB was used [before] this commit, and 770 MB is in use at the peak
of the compiler [after] this commit. That's a nice 7.5% improvement! This won't
quite make up for the losses in #44142 but I figured it's a good start.

[before]: https://gist.github.com/alexcrichton/2d2b9c7a65503761925c5a0bcfeb0d1e
[before]: https://gist.github.com/alexcrichton/6da51f2a6184bfb81694cc44f06deb5b
2017-09-14 21:28:55 -07:00
John Kåre Alsaker
efc7d46188 Analyse storage liveness and preserve it during generator transformation 2017-09-13 23:28:10 +02:00
Alex Burka
d516434981 stabilize mem::discriminant (closes #24263) 2017-09-02 01:59:54 -04:00
bors
6f82dea299 Auto merge of #44059 - oli-obk:ok_suggestion, r=nikomatsakis
Suggest `Ok(())` when encountering `Result::<(), E>::Ok()`
2017-08-29 06:18:23 +00:00
Oliver Schneider
0b72497307
Suggest Ok(()) when encountering Ok() 2017-08-28 14:13:14 +02:00
John Kåre Alsaker
d29af37999 Merge branch 'master' of https://github.com/rust-lang/rust into gen 2017-08-28 02:41:16 +02:00
Tamir Duberstein
b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
Alex Crichton
b31998ec93 Merge remote-tracking branch 'origin/master' into gen 2017-08-21 10:41:56 -07:00
Vadim Petrochenkov
de4dbe5789 rustc: Remove some dead code 2017-08-19 13:27:16 +03:00
Alex Crichton
4b5f330c70 Merge remote-tracking branch 'origin/master' into gen 2017-08-17 13:23:20 -07:00
Corey Farwell
a4387d54dc Rollup merge of #43891 - Fourchaux:master, r=steveklabnik
Fix typos & us spellings

Fixing some typos and non en-US spellings.

(Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-17 10:44:07 -04:00
Alex Crichton
5f4a99fa8b Merge remote-tracking branch 'origin/master' into gen 2017-08-16 11:33:10 -07:00
Alex Crichton
1210ebff43 Merge remote-tracking branch 'origin/master' into gen 2017-08-16 10:03:47 -07:00
Felix S. Klock II
018784afc9 MIR based borrow check (opt-in).
One can either use `-Z borrowck-mir` or add the `#[rustc_mir_borrowck]` attribute
to opt into MIR based borrow checking.

Note that regardless of whether one opts in or not, AST-based borrow
check will still run as well.  The errors emitted from AST-based
borrow check will include a "(Ast)" suffix in their error message,
while the errors emitted from MIR-based borrow check will include a
"(Mir)" suffix.

post-rebase: removed check for intra-statement mutual conflict;
replaced with assertion checking that at most one borrow is generated
per statement.

post-rebase: removed dead code: `IdxSet::pairs` and supporting stuff.
2017-08-16 16:08:28 +02:00
Felix S. Klock II
9b8b8c6aeb Move DataFlowState::{each_bit,interpret_set} method definitions to parent module.
Refactored `each_bit`, which traverses a `IdxSet`, so that the bulk of
its implementation lives in `rustc_data_structures`.
2017-08-16 15:53:27 +02:00