rustc_middle::dep_graph::dep_node

Trait DepNodeExt

Source
pub trait DepNodeExt: Sized {
    // Required methods
    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§

Source

fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId>

Extracts the DefId corresponding to this DepNode. This will work if two conditions are met:

  1. The Fingerprint of the DepNode actually is a DefPathHash, and
  2. 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.

Source

fn from_label_string( tcx: TyCtxt<'_>, label: &str, def_path_hash: DefPathHash, ) -> Result<Self, ()>

Used in testing

Source

fn has_label_string(label: &str) -> bool

Used in testing

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§