1
1
//! Defines a unit of change that can applied to the database to get the next
2
2
//! state. Changes are transactional.
3
3
use base_db:: {
4
- salsa:: Durability , CrateGraph , CrateId , FileChange , SourceRoot , SourceRootDatabase ,
5
- TargetLayoutLoadResult , Version ,
4
+ salsa:: Durability , CrateGraph , CrateId , CrateWorkspaceData , FileChange , SourceRoot ,
5
+ SourceRootDatabase ,
6
6
} ;
7
- use la_arena :: RawIdx ;
7
+ use rustc_hash :: FxHashMap ;
8
8
use span:: FileId ;
9
9
use triomphe:: Arc ;
10
10
@@ -14,8 +14,6 @@ use crate::{db::ExpandDatabase, proc_macro::ProcMacros};
14
14
pub struct ChangeWithProcMacros {
15
15
pub source_change : FileChange ,
16
16
pub proc_macros : Option < ProcMacros > ,
17
- pub toolchains : Option < Vec < Option < Version > > > ,
18
- pub target_data_layouts : Option < Vec < TargetLayoutLoadResult > > ,
19
17
}
20
18
21
19
impl ChangeWithProcMacros {
@@ -28,46 +26,25 @@ impl ChangeWithProcMacros {
28
26
if let Some ( proc_macros) = self . proc_macros {
29
27
db. set_proc_macros_with_durability ( Arc :: new ( proc_macros) , Durability :: HIGH ) ;
30
28
}
31
- if let Some ( target_data_layouts) = self . target_data_layouts {
32
- for ( id, val) in target_data_layouts. into_iter ( ) . enumerate ( ) {
33
- db. set_data_layout_with_durability (
34
- CrateId :: from_raw ( RawIdx :: from ( id as u32 ) ) ,
35
- val,
36
- Durability :: HIGH ,
37
- ) ;
38
- }
39
- }
40
- if let Some ( toolchains) = self . toolchains {
41
- for ( id, val) in toolchains. into_iter ( ) . enumerate ( ) {
42
- db. set_toolchain_with_durability (
43
- CrateId :: from_raw ( RawIdx :: from ( id as u32 ) ) ,
44
- val,
45
- Durability :: HIGH ,
46
- ) ;
47
- }
48
- }
49
29
}
50
30
51
31
pub fn change_file ( & mut self , file_id : FileId , new_text : Option < String > ) {
52
32
self . source_change . change_file ( file_id, new_text)
53
33
}
54
34
55
- pub fn set_crate_graph ( & mut self , graph : CrateGraph ) {
56
- self . source_change . set_crate_graph ( graph)
35
+ pub fn set_crate_graph (
36
+ & mut self ,
37
+ graph : CrateGraph ,
38
+ ws_data : FxHashMap < CrateId , Arc < CrateWorkspaceData > > ,
39
+ ) {
40
+ self . source_change . set_crate_graph ( graph) ;
41
+ self . source_change . set_ws_data ( ws_data) ;
57
42
}
58
43
59
44
pub fn set_proc_macros ( & mut self , proc_macros : ProcMacros ) {
60
45
self . proc_macros = Some ( proc_macros) ;
61
46
}
62
47
63
- pub fn set_toolchains ( & mut self , toolchains : Vec < Option < Version > > ) {
64
- self . toolchains = Some ( toolchains) ;
65
- }
66
-
67
- pub fn set_target_data_layouts ( & mut self , target_data_layouts : Vec < TargetLayoutLoadResult > ) {
68
- self . target_data_layouts = Some ( target_data_layouts) ;
69
- }
70
-
71
48
pub fn set_roots ( & mut self , roots : Vec < SourceRoot > ) {
72
49
self . source_change . set_roots ( roots)
73
50
}
0 commit comments