@@ -198,6 +198,46 @@ macro_rules! define_dep_nodes {
198198 }
199199
200200 impl DepNode {
201+ pub fn new_compile_codegen_unit( tcx: TyCtxt <' tcx>, s: InternedString ) -> DepNode {
202+ let hash = DepNodeParams :: to_fingerprint( & s, tcx) ;
203+ let dep_node = DepNode {
204+ kind: DepKind :: CompileCodegenUnit ,
205+ hash
206+ } ;
207+
208+ if cfg!( debug_assertions) &&
209+ !dep_node. kind. can_reconstruct_query_key( ) &&
210+ ( tcx. sess. opts. debugging_opts. incremental_info ||
211+ tcx. sess. opts. debugging_opts. query_dep_graph)
212+ {
213+ tcx. dep_graph. register_dep_node_debug_str( dep_node, || {
214+ s. to_debug_str( tcx)
215+ } ) ;
216+ }
217+
218+ dep_node
219+ }
220+
221+ pub fn new_crate_metadata( tcx: TyCtxt <' tcx>, cnum: CrateNum ) -> DepNode {
222+ let hash = DepNodeParams :: to_fingerprint( & cnum, tcx) ;
223+ let dep_node = DepNode {
224+ kind: DepKind :: CrateMetadata ,
225+ hash
226+ } ;
227+
228+ if cfg!( debug_assertions) &&
229+ !dep_node. kind. can_reconstruct_query_key( ) &&
230+ ( tcx. sess. opts. debugging_opts. incremental_info ||
231+ tcx. sess. opts. debugging_opts. query_dep_graph)
232+ {
233+ tcx. dep_graph. register_dep_node_debug_str( dep_node, || {
234+ cnum. to_debug_str( tcx)
235+ } ) ;
236+ }
237+
238+ dep_node
239+ }
240+
201241 #[ allow( unreachable_code, non_snake_case) ]
202242 #[ inline( always) ]
203243 pub fn new<' tcx>( tcx: TyCtxt <' tcx>,
0 commit comments