Expand description

This pass is only used for the UNIT TESTS and DEBUGGING NEEDS around dependency graph construction. It serves two purposes; it will dump graphs in graphviz form to disk, and it searches for #[rustc_if_this_changed] and #[rustc_then_this_would_need] annotations. These annotations can be used to test whether paths exist in the graph. These checks run after codegen, so they view the the final state of the dependency graph. Note that there are similar assertions found in persist::dirty_clean which check the initial state of the dependency graph, just after it has been loaded from disk.

In this code, we report errors on each rustc_if_this_changed annotation. If a path exists in all cases, then we would report “all path(s) exist”. Otherwise, we report: “no path to foo” for each case where no path exists. ui tests can then be used to check when paths exist or do not.

The full form of the rustc_if_this_changed annotation is #[rustc_if_this_changed("foo")], which will report a source node of foo(def_id). The "foo" is optional and defaults to "Hir" if omitted.

Example:

#[rustc_if_this_changed(Hir)]
fn foo() { }

#[rustc_then_this_would_need(codegen)] //~ ERROR no path from `foo`
fn bar() { }

#[rustc_then_this_would_need(codegen)] //~ ERROR OK
fn baz() { foo(); }

Structs

Functions

Type Aliases