11//! Defines a unit of change that can applied to the database to get the next
22//! state. Changes are transactional.
33use base_db:: {
4- salsa:: Durability , CrateGraph , CrateId , FileChange , SourceRoot , SourceRootDatabase ,
5- TargetLayoutLoadResult , Version ,
4+ salsa:: Durability , CrateGraph , CrateId , CrateWorkspaceData , FileChange , SourceRoot ,
5+ SourceRootDatabase ,
66} ;
7- use la_arena :: RawIdx ;
7+ use rustc_hash :: FxHashMap ;
88use span:: FileId ;
99use triomphe:: Arc ;
1010
@@ -14,8 +14,6 @@ use crate::{db::ExpandDatabase, proc_macro::ProcMacros};
1414pub struct ChangeWithProcMacros {
1515 pub source_change : FileChange ,
1616 pub proc_macros : Option < ProcMacros > ,
17- pub toolchains : Option < Vec < Option < Version > > > ,
18- pub target_data_layouts : Option < Vec < TargetLayoutLoadResult > > ,
1917}
2018
2119impl ChangeWithProcMacros {
@@ -28,46 +26,25 @@ impl ChangeWithProcMacros {
2826 if let Some ( proc_macros) = self . proc_macros {
2927 db. set_proc_macros_with_durability ( Arc :: new ( proc_macros) , Durability :: HIGH ) ;
3028 }
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- }
4929 }
5030
5131 pub fn change_file ( & mut self , file_id : FileId , new_text : Option < String > ) {
5232 self . source_change . change_file ( file_id, new_text)
5333 }
5434
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) ;
5742 }
5843
5944 pub fn set_proc_macros ( & mut self , proc_macros : ProcMacros ) {
6045 self . proc_macros = Some ( proc_macros) ;
6146 }
6247
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-
7148 pub fn set_roots ( & mut self , roots : Vec < SourceRoot > ) {
7249 self . source_change . set_roots ( roots)
7350 }
0 commit comments