Commit Graph

417 Commits

Author SHA1 Message Date
Mazdak Farrokhzad f1701ddef1 rustc: remove rustc_hir_pretty dependency. 2020-03-24 08:44:55 +01:00
Mazdak Farrokhzad b3866a5c93 move rustc_hir::print -> rustc_hir_pretty 2020-03-24 06:25:03 +01:00
bors 37c945dd61 Auto merge of #70204 - Centril:unshackled-lowering, r=Zoxc
Liberate `rustc_ast_lowering` from `rustc`

The whole point of this PR is the very last commit, in which we remove `rustc` as one of `rustc_ast_lowering`'s dependencies, thereby improving `./x.py` parallelism and working towards https://github.com/rust-lang/rust/issues/65031.

Noteworthy:
- From `rustc::arena` we move logic into `arena`, in particular `declare_arena!`. This is then used in `rustc_ast_lowering` so that lowering has its own separate arena.
- Some linting code is unfortunately moved to `rustc_session::lint` cause its used both in `rustc_lint` and `rustc_ast_lowering`, and this is their common dependency.
- `rustc_session::CrateDisambiguator` is moved into `rustc_ast` so that `rustc::hir::map::definitions` can be moved into `rustc_hir`, so that `rustc_ast_lowering` can stop referring to `rustc::hir`.

r? @Zoxc
2020-03-23 03:10:48 +00:00
Dylan DPC 8fe8bad96b
Rollup merge of #70254 - matthiaskrgr:cl4ppy, r=Centril
couple more clippy fixes (let_and_return, if_same_then_else)

* summarize if-else-code with identical blocks (clippy::if_same_then_else)
* don't create variable bindings just to return the bound value immediately (clippy::let_and_return)
2020-03-22 15:48:41 +01:00
Matthias Krüger 74d68ea7eb don't create variable bindings just to return the bound value immediately (clippy::let_and_return) 2020-03-22 00:35:25 +01:00
Mazdak Farrokhzad 14f89ded2c {rustc::hir::map -> rustc_hir}::definitions 2020-03-21 22:20:24 +01:00
John Kåre Alsaker 0aa15d0485 Allow `hir().find` to return `None` 2020-03-21 20:12:55 +01:00
Eduard-Mihai Burtescu e8f1dfae64 hir: replace "items" terminology with "nodes" where appropriate. 2020-03-19 14:36:04 +02:00
Eduard-Mihai Burtescu 16e25f0ea3 rustc: use LocalDefId instead of DefIndex in hir::map::definitions. 2020-03-19 11:16:08 +02:00
Eduard-Mihai Burtescu f3ec069886 rustc: use LocalDefId instead of DefIndex in HirId. 2020-03-19 11:16:08 +02:00
Eduard-Mihai Burtescu 42b2adfab0 rustc: introduce DefId::as_local(self) -> Option<LocalDefId> and use it. 2020-03-19 11:15:35 +02:00
Eduard-Mihai Burtescu 55ed19fe1b rustc: make LocalDefId's index field public like DefId's is. 2020-03-19 11:15:35 +02:00
Dylan MacKenzie 7f5a2841ea Rename `from_u32_const` -> `from_u32` 2020-03-17 11:15:40 -07:00
Mark Mansi e3c15ae6bc update comment 2020-03-15 19:58:09 -05:00
Mark Mansi 7bd8ce2e50 More Method->Fn renaming 2020-03-15 19:15:55 -05:00
John Kåre Alsaker 739a1ef113 Create the `hir_to_node_id` map before `TyCtxt` 2020-03-14 22:52:31 +01:00
John Kåre Alsaker 396aeb83c0 Optimize the HIR map 2020-03-14 22:52:31 +01:00
John Kåre Alsaker 0e316e29e6 Fix HIR map validation 2020-03-14 22:52:30 +01:00
John Kåre Alsaker 8b16b023b1 Index HIR after creating TyCtxt 2020-03-14 22:52:30 +01:00
John Kåre Alsaker e9d166fac5 Clean up the collector 2020-03-14 22:52:29 +01:00
John Kåre Alsaker d99b17fa64 Remove the `map` field from `Map` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 072449c0dc Update `trait_impls` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 270ee7eca3 Remove comments 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 61527c8d8c Update `find_entry` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 21942a5cf6 Update `is_hir_id_module` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 9c4308ed92 Update `find` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker d5827d8bc1 Update `get_parent_node` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker b40e6baec7 Update `visit_item_likes_in_module` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 38e613c4eb Update `krate_attrs` and `get_module` 2020-03-14 22:52:29 +01:00
John Kåre Alsaker 0c68b7a7fa Update `body_owner` and `maybe_body_owned_by` 2020-03-14 22:52:28 +01:00
John Kåre Alsaker d3c73940b7 Update `fn_decl_by_hir_id` and `fn_sig_by_hir_id` 2020-03-14 22:52:28 +01:00
John Kåre Alsaker e1a9626bb3 Update item functions 2020-03-14 22:52:28 +01:00
John Kåre Alsaker 518c78fbd3 Create Map after TyCtxt 2020-03-14 22:52:28 +01:00
John Kåre Alsaker 21386e1355 Collect the new maps 2020-03-14 22:52:28 +01:00
Yuki Okushi 8e17c8366c
Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPC
fix more clippy findings

* reduce references on match patterns (clippy::match_ref_pats)
* Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline)
* libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string)
* remove unneeded mutable references (cippy::unnecessary_mut_passed)
* libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast)
* rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes)
* call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref)
* iterate over a maps values directly. (clippy::for_kv_map)
* rustdoc: simplify boolean condition (clippy::nonminimal_bool)
* Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently)
* rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some)
* rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
2020-03-14 04:03:24 +09:00
Mazdak Farrokhzad 9bc7386970
Rollup merge of #69674 - mark-i-m:assoc-fn, r=matthewjasper
Rename DefKind::Method and TraitItemKind::Method

r? @eddyb, @Centril, or @matthewjasper

cc #69498 #60163
2020-03-12 16:32:13 +01:00
Matthias Krüger 7aad89a900 Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently) 2020-03-07 21:46:47 +01:00
Matthias Krüger 136ad015b6 fix various typos 2020-03-06 15:19:31 +01:00
Mark Mansi 3aeb9f0faf rename TraitItemKind::Method -> Fn 2020-03-03 12:49:58 -06:00
Mark Mansi 98c7ed67fb DefKind::Method -> DefKind::AssocFn 2020-03-03 12:29:07 -06:00
Matthias Krüger ecae6e4260 use question mark operator in a few places. 2020-03-03 11:52:14 +01:00
bors 360e42de82 Auto merge of #69380 - Zoxc:parent-module, r=michaelwoerister
Use a query to get parent modules

Split out from https://github.com/rust-lang/rust/pull/69015 / https://github.com/rust-lang/rust/pull/68944.

r? @michaelwoerister
2020-03-01 14:21:03 +00:00
Vadim Petrochenkov e08c279eac Rename `syntax` to `rustc_ast` in source code 2020-02-29 21:59:09 +03:00
John Kåre Alsaker 98251d8fb2 Reduce visibility of `get_module_parent_node` and remove `get_module_parent` 2020-02-29 05:59:58 +01:00
Mazdak Farrokhzad e58496c371 improve ParentHirIterator discoverability 2020-02-25 05:30:11 +01:00
Esteban Küber e5b2c66dea Do not ICE when encountering `yield` inside `async` block 2020-02-16 18:53:52 -08:00
John Kåre Alsaker a575495acc Make `krate` private 2020-02-06 17:14:38 +01:00
John Kåre Alsaker 623dcb02db Remove the `Forest` type 2020-02-06 13:41:37 +01:00
John Kåre Alsaker 20ce2f6038 Move the `krate` method to Hir and remove the Krate dep node 2020-02-06 13:23:32 +01:00
Dylan MacKenzie 4743995ed3 Use named fields for `hir::ItemKind::Impl` 2020-01-17 16:14:29 -08:00