Trait rustc_middle::dep_graph::DepNodeExt
source · [−]pub trait DepNodeExt: Sized {
fn from_def_path_hash(
tcx: TyCtxt<'_>,
def_path_hash: DefPathHash,
kind: DepKind
) -> Self;
fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId>;
fn from_label_string(
tcx: TyCtxt<'_>,
label: &str,
def_path_hash: DefPathHash
) -> Result<Self, ()>;
fn has_label_string(label: &str) -> bool;
}
Required Methods
sourcefn from_def_path_hash(
tcx: TyCtxt<'_>,
def_path_hash: DefPathHash,
kind: DepKind
) -> Self
fn from_def_path_hash(
tcx: TyCtxt<'_>,
def_path_hash: DefPathHash,
kind: DepKind
) -> Self
Construct a DepNode from the given DepKind and DefPathHash. This method will assert that the given DepKind actually requires a single DefId/DefPathHash parameter.
sourcefn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId>
fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId>
Extracts the DefId corresponding to this DepNode. This will work if two conditions are met:
- The Fingerprint of the DepNode actually is a DefPathHash, and
- the item that the DefPath refers to exists in the current tcx.
Condition (1) is determined by the DepKind variant of the DepNode. Condition (2) might not be fulfilled if a DepNode refers to something from the previous compilation session that has been removed.
sourcefn from_label_string(
tcx: TyCtxt<'_>,
label: &str,
def_path_hash: DefPathHash
) -> Result<Self, ()>
fn from_label_string(
tcx: TyCtxt<'_>,
label: &str,
def_path_hash: DefPathHash
) -> Result<Self, ()>
Used in testing
sourcefn has_label_string(label: &str) -> bool
fn has_label_string(label: &str) -> bool
Used in testing