|
11 | 11 |
|
12 | 12 | use std::fmt; |
13 | 13 |
|
14 | | -use rustc_errors::{DiagInner, TRACK_DIAGNOSTIC}; |
15 | | -use rustc_middle::dep_graph::dep_node::default_dep_kind_debug; |
16 | | -use rustc_middle::dep_graph::{DepKind, DepNode, TaskDepsRef}; |
| 14 | +use rustc_errors::DiagInner; |
| 15 | +use rustc_middle::dep_graph::TaskDepsRef; |
17 | 16 | use rustc_middle::ty::tls; |
18 | 17 |
|
19 | 18 | fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { |
@@ -65,49 +64,10 @@ fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) -> |
65 | 64 | write!(f, ")") |
66 | 65 | } |
67 | 66 |
|
68 | | -/// This is a callback from `rustc_query_system` as it cannot access the implicit state |
69 | | -/// in `rustc_middle` otherwise. |
70 | | -pub fn dep_kind_debug(kind: DepKind, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
71 | | - tls::with_opt(|opt_tcx| { |
72 | | - if let Some(tcx) = opt_tcx { |
73 | | - write!(f, "{}", tcx.dep_kind_vtable(kind).name) |
74 | | - } else { |
75 | | - default_dep_kind_debug(kind, f) |
76 | | - } |
77 | | - }) |
78 | | -} |
79 | | - |
80 | | -/// This is a callback from `rustc_query_system` as it cannot access the implicit state |
81 | | -/// in `rustc_middle` otherwise. |
82 | | -pub fn dep_node_debug(node: DepNode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
83 | | - write!(f, "{:?}(", node.kind)?; |
84 | | - |
85 | | - tls::with_opt(|opt_tcx| { |
86 | | - if let Some(tcx) = opt_tcx { |
87 | | - if let Some(def_id) = node.extract_def_id(tcx) { |
88 | | - write!(f, "{}", tcx.def_path_debug_str(def_id))?; |
89 | | - } else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(node) { |
90 | | - write!(f, "{s}")?; |
91 | | - } else { |
92 | | - write!(f, "{}", node.hash)?; |
93 | | - } |
94 | | - } else { |
95 | | - write!(f, "{}", node.hash)?; |
96 | | - } |
97 | | - Ok(()) |
98 | | - })?; |
99 | | - |
100 | | - write!(f, ")") |
101 | | -} |
102 | | - |
103 | 67 | /// Sets up the callbacks in prior crates which we want to refer to the |
104 | 68 | /// TyCtxt in. |
105 | 69 | pub fn setup_callbacks() { |
106 | 70 | rustc_span::SPAN_TRACK.swap(&(track_span_parent as fn(_))); |
107 | 71 | rustc_hir::def_id::DEF_ID_DEBUG.swap(&(def_id_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); |
108 | | - rustc_middle::dep_graph::dep_node::DEP_KIND_DEBUG |
109 | | - .swap(&(dep_kind_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); |
110 | | - rustc_middle::dep_graph::dep_node::DEP_NODE_DEBUG |
111 | | - .swap(&(dep_node_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); |
112 | | - TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _)); |
| 72 | + rustc_errors::TRACK_DIAGNOSTIC.swap(&(track_diagnostic as _)); |
113 | 73 | } |
0 commit comments