rapx/analysis/unsafety_isolation/
isolation_graph.rs

1use rustc_hir::def_id::DefId;
2
3#[derive(Debug, Clone)]
4pub struct IsolationGraphNode {
5    pub node_id: DefId,
6    //0:constructor, 1:method, 2:function
7    pub node_type: usize,
8    pub node_name: String,
9    pub node_unsafety: bool,
10    //if this node is a method, then it may have constructors
11    pub constructors: Vec<DefId>,
12    //record all unsafe callees
13    pub callees: Vec<DefId>,
14    //tag if this node has been visited for its unsafe callees
15    pub methods: Vec<DefId>,
16    pub callers: Vec<DefId>,
17    pub visited_tag: bool,
18    //record the source of the func
19    pub is_crate_api: bool,
20}
21
22impl IsolationGraphNode {
23    pub fn new(
24        node_id: DefId,
25        node_type: usize,
26        node_name: String,
27        node_unsafety: bool,
28        is_crate_api: bool,
29    ) -> Self {
30        Self {
31            node_id,
32            node_type,
33            node_name,
34            node_unsafety,
35            constructors: Vec::new(),
36            callees: Vec::new(),
37            methods: Vec::new(),
38            callers: Vec::new(),
39            visited_tag: false,
40            is_crate_api,
41        }
42    }
43}