Skip to content

Commit 534242c

Browse files
committed
Auto merge of #68944 - Zoxc:hir-map, r=<try>
[WIP] Use queries for the HIR map r? @eddyb cc @michaelwoerister
2 parents 8498c5f + 81fc1bd commit 534242c

File tree

39 files changed

+567
-621
lines changed

39 files changed

+567
-621
lines changed

src/librustc/arena.rs

+6
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ macro_rules! arena_types {
159159
[] type_binding: rustc_hir::TypeBinding<$tcx>,
160160
[] variant: rustc_hir::Variant<$tcx>,
161161
[] where_predicate: rustc_hir::WherePredicate<$tcx>,
162+
163+
// HIR query types
164+
[few] hir_map: rustc::hir::map::Map<$tcx>,
165+
[few] hir_definitions: rustc::hir::map::definitions::Definitions,
166+
[] hir_owner: rustc::hir::HirOwner<$tcx>,
167+
[] hir_owner_items: rustc::hir::HirOwnerItems<$tcx>,
162168
], $tcx);
163169
)
164170
}

src/librustc/dep_graph/dep_node.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
//! "infer" some properties for each kind of `DepNode`:
3636
//!
3737
//! * Whether a `DepNode` of a given kind has any parameters at all. Some
38-
//! `DepNode`s, like `AllLocalTraitImpls`, represent global concepts with only one value.
38+
//! `DepNode`s, like `?`, represent global concepts with only one value.
3939
//! * Whether it is possible, in principle, to reconstruct a query key from a
4040
//! given `DepNode`. Many `DepKind`s only require a single `DefId` parameter,
4141
//! in which case it is possible to map the node's fingerprint back to the
@@ -276,8 +276,8 @@ macro_rules! define_dep_nodes {
276276
/// Construct a DepNode from the given DepKind and DefPathHash. This
277277
/// method will assert that the given DepKind actually requires a
278278
/// single DefId/DefPathHash parameter.
279-
pub fn from_def_path_hash(kind: DepKind,
280-
def_path_hash: DefPathHash)
279+
pub fn from_def_path_hash(def_path_hash: DefPathHash,
280+
kind: DepKind)
281281
-> DepNode {
282282
debug_assert!(kind.can_reconstruct_query_key() && kind.has_params());
283283
DepNode {
@@ -333,7 +333,7 @@ macro_rules! define_dep_nodes {
333333
}
334334

335335
if kind.has_params() {
336-
Ok(def_path_hash.to_dep_node(kind))
336+
Ok(DepNode::from_def_path_hash(def_path_hash, kind))
337337
} else {
338338
Ok(DepNode::new_no_params(kind))
339339
}
@@ -390,28 +390,13 @@ impl fmt::Debug for DepNode {
390390
}
391391
}
392392

393-
impl DefPathHash {
394-
pub fn to_dep_node(self, kind: DepKind) -> DepNode {
395-
DepNode::from_def_path_hash(kind, self)
396-
}
397-
}
398-
399393
rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
400394
// We use this for most things when incr. comp. is turned off.
401395
[] Null,
402396

403-
// Represents the body of a function or method. The def-id is that of the
404-
// function/method.
405-
[eval_always] HirBody(DefId),
406-
407-
// Represents the HIR node with the given node-id
408-
[eval_always] Hir(DefId),
409-
410397
// Represents metadata from an extern crate.
411398
[eval_always] CrateMetadata(CrateNum),
412399

413-
[eval_always] AllLocalTraitImpls,
414-
415400
[anon] TraitSelect,
416401

417402
[] CompileCodegenUnit(Symbol),

src/librustc/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ impl DepGraph {
677677
}
678678
} else {
679679
match dep_dep_node.kind {
680-
DepKind::Hir | DepKind::HirBody | DepKind::CrateMetadata => {
680+
DepKind::CrateMetadata => {
681681
if let Some(def_id) = dep_dep_node.extract_def_id(tcx) {
682682
if def_id_corresponds_to_hir_dep_node(tcx, def_id) {
683683
// The `DefPath` has corresponding node,

0 commit comments

Comments
 (0)