diff options
| author | bors <bors@rust-lang.org> | 2022-07-07 18:14:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-07 18:14:44 +0000 |
| commit | 0f573a0c5474ad65bc9f0b0fd3a94d1b06dcfdfa (patch) | |
| tree | 76e166db0204687bf633bfc00b5af062e732d286 /compiler/rustc_hir | |
| parent | 3e51277fe638dc0c8ceb6d1d3acc5aa247277c29 (diff) | |
| parent | 32a30cad0375e61eeac483f811413a9a26102ebf (diff) | |
| download | rust-0f573a0c5474ad65bc9f0b0fd3a94d1b06dcfdfa.tar.gz rust-0f573a0c5474ad65bc9f0b0fd3a94d1b06dcfdfa.zip | |
Auto merge of #95573 - cjgillot:lower-query, r=michaelwoerister
Make lowering a query Split from https://github.com/rust-lang/rust/pull/88186. This PR refactors the relationship between lowering and the resolver outputs in order to make lowering itself a query. In a first part, lowering is changed to avoid modifying resolver outputs, by maintaining its own data structures for creating new `NodeId`s and so. Then, the `TyCtxt` is modified to allow creating new `LocalDefId`s from inside it. This is done by: - enclosing `Definitions` in a lock, so as to allow modification; - creating a query `register_def` whose purpose is to declare a `LocalDefId` to the query system. See `TyCtxt::create_def` and `TyCtxt::iter_local_def_id` for more detailed explanations of the design.
Diffstat (limited to 'compiler/rustc_hir')
| -rw-r--r-- | compiler/rustc_hir/Cargo.toml | 1 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/arena.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/lib.rs | 4 |
3 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_hir/Cargo.toml b/compiler/rustc_hir/Cargo.toml index 064ed0cde96..69ad623b7ea 100644 --- a/compiler/rustc_hir/Cargo.toml +++ b/compiler/rustc_hir/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" doctest = false [dependencies] +rustc_arena = { path = "../rustc_arena" } rustc_target = { path = "../rustc_target" } rustc_macros = { path = "../rustc_macros" } rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_hir/src/arena.rs b/compiler/rustc_hir/src/arena.rs index 5d1314ebb48..a6d10f3adae 100644 --- a/compiler/rustc_hir/src/arena.rs +++ b/compiler/rustc_hir/src/arena.rs @@ -9,7 +9,7 @@ macro_rules! arena_types { // HIR types [] hir_krate: rustc_hir::Crate<'tcx>, [] arm: rustc_hir::Arm<'tcx>, - [] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, Span), + [] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, rustc_span::Span), [] asm_template: rustc_ast::InlineAsmTemplatePiece, [] attribute: rustc_ast::Attribute, [] block: rustc_hir::Block<'tcx>, diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 9f32a7da159..0f9e6fa7b98 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -18,6 +18,8 @@ extern crate rustc_macros; #[macro_use] extern crate rustc_data_structures; +extern crate self as rustc_hir; + mod arena; pub mod def; pub mod def_path_hash_map; @@ -41,3 +43,5 @@ pub use hir_id::*; pub use lang_items::{LangItem, LanguageItems}; pub use stable_hash_impls::HashStableContext; pub use target::{MethodKind, Target}; + +arena_types!(rustc_arena::declare_arena); |
