@@ -26,7 +26,7 @@ use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex
26
26
use super :: { DepContext , DepKind , DepNode , Deps , HasDepContext , WorkProductId } ;
27
27
use crate :: dep_graph:: edges:: EdgesVec ;
28
28
use crate :: ich:: StableHashingContext ;
29
- use crate :: query:: { QueryContext , QuerySideEffect } ;
29
+ use crate :: query:: { DefIdInfo , QueryContext , QuerySideEffect } ;
30
30
31
31
#[ derive( Clone ) ]
32
32
pub struct DepGraph < D : Deps > {
@@ -260,6 +260,7 @@ impl<D: Deps> DepGraph<D> {
260
260
}
261
261
262
262
#[ inline( always) ]
263
+ /// A helper for `codegen_cranelift`.
263
264
pub fn with_task < Ctxt : HasDepContext < Deps = D > , A : Debug , R > (
264
265
& self ,
265
266
key : DepNode ,
@@ -530,6 +531,18 @@ impl<D: Deps> DepGraph<D> {
530
531
} )
531
532
}
532
533
}
534
+
535
+ pub fn record_def < Qcx : QueryContext > ( & self , qcx : Qcx , def : DefIdInfo ) {
536
+ if let Some ( ref data) = self . data {
537
+ D :: read_deps ( |task_deps| match task_deps {
538
+ TaskDepsRef :: EvalAlways | TaskDepsRef :: Ignore => return ,
539
+ TaskDepsRef :: Forbid | TaskDepsRef :: Allow ( ..) => {
540
+ self . read_index ( data. encode_side_effect ( qcx, QuerySideEffect :: Definition ( def) ) ) ;
541
+ }
542
+ } )
543
+ }
544
+ }
545
+
533
546
/// This forces a diagnostic node green by running its side effect. `prev_index` would
534
547
/// refer to a node created used [Self::record_diagnostic] in the previous session.
535
548
#[ inline]
@@ -667,7 +680,7 @@ impl<D: Deps> DepGraphData<D> {
667
680
self . debug_loaded_from_disk . lock ( ) . insert ( dep_node) ;
668
681
}
669
682
670
- /// This encodes a diagnostic by creating a node with an unique index and assoicating
683
+ /// This encodes a diagnostic by creating a node with an unique index and associating
671
684
/// `diagnostic` with it, for use in the next session.
672
685
#[ inline]
673
686
fn encode_side_effect < Qcx : QueryContext > (
@@ -705,6 +718,9 @@ impl<D: Deps> DepGraphData<D> {
705
718
QuerySideEffect :: Diagnostic ( diagnostic) => {
706
719
qcx. dep_context ( ) . sess ( ) . dcx ( ) . emit_diagnostic ( diagnostic. clone ( ) ) ;
707
720
}
721
+ QuerySideEffect :: Definition ( def_id_info) => {
722
+ qcx. dep_context ( ) . create_def ( def_id_info)
723
+ }
708
724
}
709
725
710
726
// Use `send_and_color` as `promote_node_and_deps_to_current` expects all
0 commit comments