1
1
//! Determining which types for which we can emit `#[derive(Debug)]`.
2
2
3
- use super :: { ConstrainResult , MonotoneFramework } ;
3
+ use super :: { ConstrainResult , MonotoneFramework , generate_dependencies } ;
4
4
use std:: collections:: HashSet ;
5
5
use std:: collections:: HashMap ;
6
6
use ir:: context:: { BindgenContext , ItemId } ;
@@ -9,7 +9,6 @@ use ir::traversal::EdgeKind;
9
9
use ir:: ty:: RUST_DERIVE_IN_ARRAY_LIMIT ;
10
10
use ir:: ty:: TypeKind ;
11
11
use ir:: comp:: Field ;
12
- use ir:: traversal:: Trace ;
13
12
use ir:: comp:: FieldMethods ;
14
13
use ir:: derive:: CanTriviallyDeriveDebug ;
15
14
use ir:: comp:: CompKind ;
@@ -99,24 +98,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDebug<'ctx, 'gen> {
99
98
100
99
fn new ( ctx : & ' ctx BindgenContext < ' gen > ) -> CannotDeriveDebug < ' ctx , ' gen > {
101
100
let cannot_derive_debug = HashSet :: new ( ) ;
102
- let mut dependencies = HashMap :: new ( ) ;
103
-
104
- for & item in ctx. whitelisted_items ( ) {
105
- dependencies. entry ( item) . or_insert ( vec ! [ ] ) ;
106
-
107
- {
108
- // We reverse our natural IR graph edges to find dependencies
109
- // between nodes.
110
- item. trace ( ctx, & mut |sub_item : ItemId , edge_kind| {
111
- if ctx. whitelisted_items ( ) . contains ( & sub_item) &&
112
- Self :: consider_edge ( edge_kind) {
113
- dependencies. entry ( sub_item)
114
- . or_insert ( vec ! [ ] )
115
- . push ( item) ;
116
- }
117
- } , & ( ) ) ;
118
- }
119
- }
101
+ let dependencies = generate_dependencies ( ctx, Self :: consider_edge) ;
120
102
121
103
CannotDeriveDebug {
122
104
ctx,
0 commit comments