Commit Graph

294 Commits

Author SHA1 Message Date
John Kåre Alsaker
fb578794b0 Update privacy_access_levels 2019-05-23 18:51:49 +02:00
Fabian Drinck
b18de52080 Declare DefIndex with the newtype_index macro 2019-05-18 13:19:33 +02:00
Nicholas Nethercote
999c1fc281 Remove the equality operation between Symbol and strings.
And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.
2019-05-13 09:31:30 +10:00
Nicholas Nethercote
fb084a48e2 Pass a Symbol to check_name, emit_feature_err, and related functions. 2019-05-13 09:29:22 +10:00
Vadim Petrochenkov
7da9250fb5 Remove Res::Label
Paths can never resolve to labels
2019-05-04 17:22:00 +03:00
Eduard-Mihai Burtescu
ff174fe09e rustc: rename hir::def::Def to Res (short for "resolution"). 2019-05-03 22:50:19 +03:00
Eduard-Mihai Burtescu
a3fcab36d2 rustc: factor most DefId-containing variants out of Def and into DefKind. 2019-05-03 22:48:27 +03:00
Igor Matuszewski
25451967ee save-analysis: Use serde instead of libserialize to dump JSON data 2019-04-21 12:45:16 +02:00
Mateusz Mikuła
87e4b43d51 Deny internal in stage0 2019-04-17 05:15:00 +02:00
ljedrz
3b99a48c4d HirIdify hir::Def 2019-04-14 09:30:02 +02:00
Igor Matuszewski
bcd263e1f1 save-analysis: Simplify match arm for type node def 2019-04-11 23:53:59 +02:00
Igor Matuszewski
1ced262653 save-analysis: use qpath_def for associated types 2019-04-11 23:37:05 +02:00
flip1995
d3f0cb9b62
Deny internal lints on non conflicting crates
- libarena
- librustc_allocator
- librustc_borrowck
- librustc_codegen_ssa
- librustc_codegen_utils
- librustc_driver
- librustc_errors
- librustc_incremental
- librustc_metadata
- librustc_passes
- librustc_privacy
- librustc_resolve
- librustc_save_analysis
- librustc_target
- librustc_traits
- libsyntax
- libsyntax_ext
- libsyntax_pos
2019-04-03 18:24:21 +02:00
Mazdak Farrokhzad
4720fcac4c
Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=oli-obk
Type dependent defs wrappers

First of all, forgive me if something would seem lame to you or I offend some rule (although I tried to read through docs), this is my first PR.

Issue: https://github.com/rust-lang/rust/issues/59094

This PR adds 3 helper methods to `TypeckTables`:
* `opt_type_dependent_def`
* `opt_type_dependent_def_id`
* `type_dependent_def_id`

I didn't add `type_dependent_def` as was proposed in the issue simply because it wasn't used anywhere in the code. Only non-option wrapped`type_dependent_defs()[]` accesses were found in clippy which always called `def_id()` on result.
Speaking of clippy, should I open separate PR in its own repo, given it's used as submodule here?

Sry it took me so long, as I said I'm new here and I had tough week :).
2019-03-28 13:35:33 +01:00
David Wood
23cae1d3f0
Re-order fields in Def::Ctor.
This commit moves the `DefId` field of `Def::Ctor` to be the first
field.
2019-03-24 19:16:44 +01:00
David Wood
88f8f07794
Move CtorOf into hir::def.
This commit moves the definition of `CtorOf` from `rustc::hir` to
`rustc::hir::def` and adds imports wherever it is used.
2019-03-24 18:54:56 +01:00
David Wood
5c3d1e5d76 Separate variant id and variant constructor id.
This commit makes two changes - separating the `NodeId` that identifies
an enum variant from the `NodeId` that identifies the variant's
constructor; and no longer creating a `NodeId` for `Struct`-style enum
variants and structs.

Separation of the variant id and variant constructor id will allow the
rest of RFC 2008 to be implemented by lowering the visibility of the
variant's constructor without lowering the visbility of the variant
itself.

No longer creating a `NodeId` for `Struct`-style enum variants and
structs mostly simplifies logic as previously this `NodeId` wasn't used.
There were various cases where the `NodeId` wouldn't be used unless
there was an unit or tuple struct or enum variant but not all uses of
this `NodeId` had that condition, by removing this `NodeId`, this must
be explicitly dealt with. This change mostly applied cleanly, but there
were one or two cases in name resolution and one case in type check
where the existing logic required a id for `Struct`-style enum variants
and structs.
2019-03-24 12:10:16 +03:00
Tomas Koutsky
f4742f46fe Add def getting methods to librustc/ty/context 2019-03-16 13:14:06 +01:00
Eduard-Mihai Burtescu
27ddf2cec8 rustc: replace node_path_str with uses of def_path_str. 2019-03-15 13:25:10 +02:00
Eduard-Mihai Burtescu
e0c75ff40d rustc: rename item_path to def_path (except the module in ty). 2019-03-15 13:25:10 +02:00
Eduard-Mihai Burtescu
f1af5a77a0 rustc: remove TyCtxt::parent_def_id in favor of TyCtxt::parent. 2019-03-15 13:25:10 +02:00
ljedrz
558a07b896 hir: remove NodeId from PatKind 2019-03-07 12:18:59 +01:00
ljedrz
00b74e5eaf hir: remove NodeId from Lifetime and Ty 2019-02-24 07:50:44 +01:00
Nicholas Nethercote
5d65e8cc7a Reduce the size of hir::Expr.
From 104 bytes to 72 bytes on x86-64. This slightly reduces instruction
counts.

Also add an assertion about the size.
2019-02-14 11:52:03 +11:00
bors
b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
Alexander Regueiro
c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
Taiki Endo
2be0993c4e Revert removed #![feature(nll)] 2019-02-10 16:13:30 +09:00
Mazdak Farrokhzad
2b8ed1e1bd
Rollup merge of #58233 - taiki-e:librustc_save_analysis-2018, r=Centril
librustc_save_analysis => 2018

Transitions `librustc_save_analysis` to Rust 2018; cc #58099

r? @Centril
2019-02-09 00:15:50 +01:00
bors
43e04fb552 Auto merge of #58191 - varkor:const-generics-ast, r=petrochenkov
Add const generics to the AST

This is mostly split out from https://github.com/rust-lang/rust/pull/53645 in an effort to make progress merging const generics piecewise instead of in one go.

cc @yodaldevoid, @petrochenkov

r? @eddyb
2019-02-08 05:50:16 +00:00
varkor
29f7206366 Add const params to Def
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07 15:02:17 +01:00
Guillaume Gomez
8b886e07f5 Remove images' url to make it work even without internet connection 2019-02-07 11:06:19 +01:00
Taiki Endo
ba0fbd763d librustc_save_analysis => 2018 2019-02-07 01:02:00 +09:00
Igor Matuszewski
6f1d06d219 Querify glob map usage (last use of CrateAnalysis) 2019-01-17 10:40:22 +01:00
bors
c40b97796e Auto merge of #57392 - Xanewok:always-calc-glob-map, r=petrochenkov
Always calculate glob map but only for glob uses

Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance.

Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand).

r? @nikomatsakis

Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
2019-01-16 23:25:41 +00:00
Igor Matuszewski
df9df19507 Always calculate glob map but only for glob uses
Previously calculating glob map was *opt-in*, however it did record
node id -> ident use for every use directive. This aims to see if we
can unconditionally calculate the glob map and not regress performance.
2019-01-13 10:42:59 +01:00
Mazdak Farrokhzad
edec83835a
Rollup merge of #57474 - emilio:save-analysis-path, r=nrc
save-analysis: Get path def from parent in case there's no def for the path itself.

This fixes #57462.

The relevant part from the hir type collector is:

```
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(32) => Entry { parent: NodeId(33), dep_node: 4294967040, node: Expr(expr(32: <Foo>::new)) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(48) => Entry { parent: NodeId(32), dep_node: 4294967040, node: Ty(type(Foo)) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(30) => Entry { parent: NodeId(48), dep_node: 4294967040, node: PathSegment(PathSegment { ident: Foo#0, id: Some(NodeId(30)), def: Some(Err), args: None, infer_types: true }) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(31) => Entry { parent: NodeId(32), dep_node: 4294967040, node: PathSegment(PathSegment { ident: new#0, id: Some(NodeId(31)), def: Some(Err), args: None, infer_types: true }) }
```

We have the right ID when looking for NodeId(31) and try with NodeId(32) (which
is the right thing to look for) from get_path_data. But not when we look from `write_sub_paths_truncated`

Basically process_path takes an id which is always the parent, and that we
fall back to in get_path_data(), so we get the right result for the last path
segment, but not for the other segments that get written to from
write_sub_paths_truncated.

I think we can stop passing the explicit `id` around to get_path_data as a followup.
2019-01-13 05:26:53 +01:00
Emilio Cobos Álvarez
c47ed149b2 save-analysis: Get path def from parent in case there's no def for the path itself.
This fixes #57462.

The relevant part from the hir type collector is:

```
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(32) => Entry { parent: NodeId(33), dep_node: 4294967040, node: Expr(expr(32: <Foo>::new)) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(48) => Entry { parent: NodeId(32), dep_node: 4294967040, node: Ty(type(Foo)) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(30) => Entry { parent: NodeId(48), dep_node: 4294967040, node: PathSegment(PathSegment { ident: Foo#0, id: Some(NodeId(30)), def: Some(Err), args: None, infer_types: true }) }
DEBUG 2019-01-09T15:42:58Z: rustc::hir::map::collector: hir_map: NodeId(31) => Entry { parent: NodeId(32), dep_node: 4294967040, node: PathSegment(PathSegment { ident: new#0, id: Some(NodeId(31)), def: Some(Err), args: None, infer_types: true }) }
```

We have the right ID when looking for NodeId(31) and try with NodeId(32) (which
is the right thing to look for) from get_path_data, but not for the segments
that we write from `write_sub_paths_truncated`.

Basically `process_path` takes an id which is always the parent, and that we
fall back to in `get_path_data()`, so we get the right result for the last path
segment, but not for the other segments that get written to from
`write_sub_paths_truncated`.

I think we can stop passing the explicit id around to `get_path_data` now, will
consider sending that as a followup.
2019-01-09 19:59:54 +01:00
Igor Matuszewski
eed163e110 save-analysis: use a fallback when access levels couldn't be computed 2019-01-08 01:02:13 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
John Kåre Alsaker
a70babed03 Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
Nick Cameron
99d1513ed3 save-analysis: fallback to using path id 2018-11-19 17:18:36 +13:00
Nick Cameron
63ac2aae51 Fix tests and assertions; add some comments 2018-10-26 09:50:51 +13:00
Nick Cameron
8ac3272610 save-analysis: handle missing field names
FIxes https://github.com/rust-lang-nursery/rls/issues/1031
2018-10-26 09:48:44 +13:00
Nick Cameron
c480386391 dump refs for path segments in save-analysis
Requires adding path segments to the hir map
2018-10-26 09:48:44 +13:00
Nick Cameron
609d0bd8ac dump data for prefix path segments 2018-10-26 09:48:44 +13:00
Nick Cameron
c2bb7cadf2 save-analysis: remove hacky, unnecessary code now that we have spans for every ident 2018-10-26 09:48:44 +13:00
ljedrz
d28aed6dc4 Prefer unwrap_or_else to unwrap_or in case of function calls/allocations 2018-10-19 09:45:45 +02:00
bors
6310be458f Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum
Bump to 1.31.0 and bootstrap from 1.30 beta

Closes #54594.
2018-09-30 01:45:50 +00:00
Josh Stone
ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00