Commit Graph

279 Commits

Author SHA1 Message Date
bors
98e4b6845f Auto merge of #45709 - nrc:rls-bugs-2, r=eddyb
Fix a bunch of minor save-analysis bugs

r? @eddyb
2017-11-04 15:30:20 +00:00
leonardo.yvens
1f4b630899 add auto keyword, parse auto trait, lower to HIR
Adds an `IsAuto` field to `ItemTrait` which flags if the trait was
declared as an `auto trait`.

Auto traits cannot have generics nor super traits.
2017-11-03 16:13:20 -02:00
leonardo.yvens
06506bb751 [Syntax Breaking] Rename DefaultImpl to AutoImpl
DefaultImpl is a highly confusing name for what we now call auto impls,
as in `impl Send for ..`. The name auto impl is not formally decided
but for sanity anything is better than `DefaultImpl` which refers
neither to `default impl` nor to `impl Default`.
2017-11-03 16:13:20 -02:00
bors
5ce3d482e2 Auto merge of #45647 - nrc:rls-bugs, r=eddyb
save-analysis: support unions

r? @eddyb
2017-11-02 12:34:13 +00:00
bors
2379faa933 Auto merge of #45468 - Xanewok:crate-source, r=nrc
Emit crate disambiguators in save-analysis data

Needed for https://github.com/nrc/rls-analysis/issues/93.
Blocked by https://github.com/nrc/rls-data/pull/11. (For now, this pulls my branch [rls-data/crate-source](https://github.com/Xanewok/rls-data/tree/crate-source))

This will allow to disambiguate different crates types/versions when indexing resulting save-analysis data (most importantly allow to support bin+lib and different crate versions).

r? @nrc
2017-11-02 03:36:50 +00:00
Nick Cameron
5d3be12a4d save-analysis: fix issue with sub-exprs in for loops
Fixes https://github.com/nrc/rls-analysis/issues/78
2017-11-02 14:35:39 +13:00
Nick Cameron
20c64e8155 save-analysis: corrects reference for tuple struct and unit struct literals
Fixes https://github.com/nrc/rls-analysis/issues/77
2017-11-02 11:28:56 +13:00
Nick Cameron
82a8968ce0 save-analysis: handle types in turbofish
fixes https://github.com/nrc/rls-analysis/issues/52
2017-11-02 09:22:44 +13:00
Nick Cameron
c1d3e441a8 save-analysis: handle function types in bounds
This special cases the function type sugar in paths and deals with traits bounds as just the path parts. That required refactoring the path collector to distinguish between variable decls and references in patterns, basically just to please the borrow checker.

cc https://github.com/nrc/rls-analysis/issues/37
2017-11-02 08:12:05 +13:00
Nick Cameron
a9bafe5c9e save-analysis: support unions 2017-10-31 18:24:48 +13:00
Igor Matuszewski
45fa7b26e8 Use rls-data 0.12 2017-10-27 23:53:57 +02:00
Paul Lietar
77f7e85d7f Implement RFC 1861: Extern types 2017-10-27 23:01:34 +02:00
Igor Matuszewski
e3afba5b7b Emit crate disambiguators in save-analysis data 2017-10-27 17:38:07 +02:00
Dustin Speckhals
bca47e42b2 Merge branch 'master' into update-rls-data-for-save-analysis 2017-10-24 19:37:15 -04:00
Sunjay Varma
f61394f0bd Lifting Generics from MethodSig to TraitItem and ImplItem since we want to support generics in each variant of TraitItem and ImplItem 2017-10-17 22:14:14 -04:00
Vadim Petrochenkov
e6115af4bd Implement dyn Trait syntax 2017-10-14 12:51:13 +03:00
Dustin Speckhals
57d0410f60 Update rls-data for librustc-save-analysis
0.10 -> 0.11

This will allow for more fine-grained save analysis for enum variants
(tuple and struct)
2017-10-07 16:12:51 -04:00
Eduard-Mihai Burtescu
da0a47a081 Use NodeId/HirId instead of DefId for local variables. 2017-09-08 22:00:59 +03:00
Alex Crichton
fd0aa647f3 rustc: Remove CrateStore::crates as a method
This commit moves the `crates` method to a query and then migrates all callers
to use a query instead of the now-renamed `crates_untracked` method where
possible.

Closes #41417
2017-09-07 08:13:41 -07:00
Alex Crichton
43ae380191 rustc: Flag some CrateStore methods as "untracked"
The main use of `CrateStore` *before* the `TyCtxt` is created is during
resolution, but we want to be sure that any methods used before resolution are
not used after the `TyCtxt` is created. This commit starts moving the methods
used by resolve to all be named `{name}_untracked` where the rest of the
compiler uses just `{name}` as a query.

During this transition a number of new queries were added to account for
post-resolve usage of these methods.
2017-09-05 07:37:39 -07:00
Vadim Petrochenkov
3da868dcb6 Make fields of Span private 2017-08-30 01:38:54 +03:00
Tamir Duberstein
b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
bors
80be2f8697 Auto merge of #43971 - alexcrichton:lint-statements, r=michaelwoerister
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-21 17:38:26 +00:00
Vadim Petrochenkov
de4dbe5789 rustc: Remove some dead code 2017-08-19 13:27:16 +03:00
Alex Crichton
9b6f9d0bc4 rustc: Rename NodeLocal to NodeBinding 2017-08-17 23:00:57 -07:00
Zack M. Davis
1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
bors
df511d5548 Auto merge of #43826 - kennytm:fix-43796-mis-calculated-spans, r=petrochenkov
Fix "Mis-calculated spans" errors from `-Z save-analysis` + refactoring

Removed the path span extraction methods from `SpanUtils`:

* spans_with_brackets
* spans_for_path_segments
* spans_for_ty_params

Use the `span` fields in `PathSegment` and `TyParam` instead.

(Note that since it processes `ast::Path` not a qualified path (`hir::QPath` / `ast::QSelf`), UFCS path will be flattened: `<Foo as a:🅱️:c::Trait>::D::E::F::g` will be seen as `a:🅱️:c::Trait::D::E::F::g`.)

Fix #43796. Close #41478.

r? @nrc
2017-08-14 19:55:20 +00:00
bors
0d12553320 Auto merge of #43740 - michaelwoerister:local-id-in-typecktables, r=arielb1
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-14 14:15:06 +00:00
kennytm
60377e48f0
save-analysis: Remove path span extraction methods from SpanUtils
Use the `span` field in PathSegment and TyParam instead.

Fix #43796. Close #41478.
2017-08-14 18:14:49 +08:00
Bastien Orivel
3ab86fbab2 Fix some typos 2017-08-12 14:01:11 +02:00
Michael Woerister
a69eaf62c5 Improve validation of TypeckTables keys. 2017-08-11 12:17:07 +02:00
Michael Woerister
1f54df1101 Encapsulate sub-table access in TypeckTables and validate keys on each access. 2017-08-11 12:17:07 +02:00
Michael Woerister
6cd44a9d5e Add missing TypeckTables-switch in save-analysis. 2017-08-11 12:11:38 +02:00
Michael Woerister
7f2423eede Use ItemLocalId as key for node_types, node_substs, and adjustments in TypeckTables. 2017-08-11 12:11:38 +02:00
Michael Woerister
783ccc443b Make TypeckTables::type_dependent_defs use ItemLocalId instead of NodeId. 2017-08-11 12:11:38 +02:00
Nick Cameron
2683ba631b Appease tidy and fix save-analysis config for dist builds 2017-08-03 16:31:25 +12:00
Nick Cameron
8c1699d874 Update rls-data dep 2017-08-02 16:57:50 +12:00
Nick Cameron
4e6c1dddff save-analysis: only emit public fields in value of a struct if the config permits 2017-08-02 15:46:59 +12:00
Nick Cameron
27b9182d5b review changes 2017-08-01 15:06:22 +12:00
Nick Cameron
e1206c4b67 save-anlaysis: fix filter_generated 2017-07-28 16:42:17 +12:00
Nick Cameron
66702b456c save-analysis: dedup macro references 2017-07-25 18:46:14 +12:00
Nick Cameron
81fd86e068 Catch a panic in save-analysis 2017-07-24 17:25:16 +12:00
Nick Cameron
ad8ecc20a2 Point RLS submodule at a branch with required changes
And cargo update
2017-07-24 17:25:15 +12:00
Nick Cameron
f6f03639b1 Gate signatures on the config 2017-07-22 16:35:40 +12:00
Nick Cameron
52e9f2035a Use config::pub_only rather than a spearate api mode 2017-07-22 16:35:40 +12:00
Nick Cameron
4d81e8bb22 Use Config::full_docs to trim documentation 2017-07-22 16:35:40 +12:00
Nick Cameron
84d93a4edd Use a config file with save-analysis
Replaces the output path env var. Can be passed to save-analysis via a function call or env var.
2017-07-22 16:35:40 +12:00
Tobias Schottdorf
687ee7fee4 Downgrade ProjectionTy's TraitRef to its substs
Addresses the second part of #42171 by removing the `TraitRef` from
`ProjectionTy`, and directly storing its `Substs`.

Closes #42171.
2017-07-11 10:33:09 -04:00
Corey Farwell
80e14a0fe3 Rollup merge of #42766 - nrc:versions, r=nagisa
Update rls-data version

And update the RLS submod
2017-06-21 10:40:17 -04:00
Nick Cameron
7a18a77e1b Update rls-data dep 2017-06-20 18:55:14 +12:00