Module rustc_incremental::assert_dep_graph [−][src]
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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. compile-fail
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(); }
Re-exports
use graphviz as dot; |
use rustc::dep_graph::DepGraphQuery; |
use rustc::dep_graph::DepNode; |
use rustc::dep_graph::DepKind; |
use rustc::dep_graph::debug::DepNodeFilter; |
use rustc::dep_graph::debug::EdgeFilter; |
use rustc::hir::def_id::DefId; |
use rustc::ty::TyCtxt; |
use rustc_data_structures::fx::FxHashSet; |
use rustc_data_structures::fx::FxHashSet; |
use rustc_data_structures::graph::Direction; |
use rustc_data_structures::graph::INCOMING; |
use rustc_data_structures::graph::OUTGOING; |
use rustc_data_structures::graph::NodeIndex; |
use rustc::hir; |
use rustc::hir::intravisit; |
use rustc::hir::intravisit::NestedVisitorMap; |
use rustc::hir::intravisit::Visitor; |
use rustc::ich::ATTR_IF_THIS_CHANGED; |
use rustc::ich::ATTR_THEN_THIS_WOULD_NEED; |
use graphviz::IntoCow; |
use std::env; |
use std::fs; |
use std::fs::File; |
use std::io::Write; |
use syntax::ast; |
use syntax_pos::Span; |
Structs
GraphvizDepGraph |
[ Experimental ]
|
IfThisChanged |
[ Experimental ]
|
Functions
assert_dep_graph |
[ Experimental ]
|
check_paths |
[ Experimental ]
|
dump_graph |
[ Experimental ]
|
filter_edges |
[ Experimental ]
|
filter_nodes |
[ Experimental ]
|
node_set |
[ Experimental ]
|
walk_between |
[ Experimental ]
|
walk_nodes |
[ Experimental ]
|
Type Definitions
Sources |
[ Experimental ]
|
Targets |
[ Experimental ]
|