Skip to content

Commit

Permalink
Make DepConstructor a module.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jan 8, 2021
1 parent 921b284 commit 5fcc537
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions compiler/rustc_middle/src/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
//! contained no `DefId` for thing that had been removed.
//!
//! `DepNode` definition happens in the `define_dep_nodes!()` macro. This macro
//! defines the `DepKind` enum and a corresponding `DepConstructor` enum. The
//! `DepConstructor` enum links a `DepKind` to the parameters that are needed at
//! defines the `DepKind` enum and a corresponding `dep_constructor` module. The
//! `dep_constructor` module links a `DepKind` to the parameters that are needed at
//! runtime in order to construct a valid `DepNode` fingerprint.
//!
//! Because the macro sees what parameters a given `DepKind` requires, it can
Expand All @@ -44,7 +44,7 @@
//! `DefId` it was computed from. In other cases, too much information gets
//! lost during fingerprint computation.
//!
//! The `DepConstructor` enum, together with `DepNode::new()`, ensures that only
//! The `dep_constructor` module, together with `DepNode::new()`, ensures that only
//! valid `DepNode` instances can be constructed. For example, the API does not
//! allow for constructing parameterless `DepNode`s with anything other
//! than a zeroed out fingerprint. More generally speaking, it relieves the
Expand Down Expand Up @@ -331,10 +331,10 @@ macro_rules! define_dep_nodes {
$($variant),*
}

pub struct DepConstructor;

#[allow(non_camel_case_types)]
impl DepConstructor {
pub mod dep_constructor {
use super::*;

$(
#[inline(always)]
#[allow(unreachable_code, non_snake_case)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub use rustc_query_system::dep_graph::{
WorkProduct, WorkProductId,
};

pub use dep_node::{label_strs, DepConstructor, DepKind, DepNode, DepNodeExt};
pub use dep_node::{dep_constructor, label_strs, DepKind, DepNode, DepNodeExt};

pub type DepGraph = rustc_query_system::dep_graph::DepGraph<DepKind>;
pub type TaskDeps = rustc_query_system::dep_graph::TaskDeps<DepKind>;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/mir/mono.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId};
use crate::dep_graph::{dep_constructor, DepNode, WorkProduct, WorkProductId};
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt};
use rustc_attr::InlineAttr;
Expand Down Expand Up @@ -362,7 +362,7 @@ impl<'tcx> CodegenUnit<'tcx> {
}

pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx>) -> DepNode {
DepConstructor::CompileCodegenUnit(tcx, self.name())
dep_constructor::CompileCodegenUnit(tcx, self.name())
}
}

Expand Down

0 comments on commit 5fcc537

Please sign in to comment.