File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
crates/ra_proc_macro_srv/src Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,14 @@ use proc_macro::bridge::client::TokenStream;
23
23
use ra_proc_macro:: { ExpansionResult , ExpansionTask , ListMacrosResult , ListMacrosTask } ;
24
24
use std:: {
25
25
collections:: { hash_map:: Entry , HashMap } ,
26
+ fs:: metadata,
26
27
path:: { Path , PathBuf } ,
28
+ time:: SystemTime ,
27
29
} ;
28
30
29
31
#[ derive( Default ) ]
30
32
pub ( crate ) struct ProcMacroSrv {
31
- expanders : HashMap < PathBuf , dylib:: Expander > ,
33
+ expanders : HashMap < ( PathBuf , SystemTime ) , dylib:: Expander > ,
32
34
}
33
35
34
36
impl ProcMacroSrv {
@@ -48,7 +50,11 @@ impl ProcMacroSrv {
48
50
}
49
51
50
52
fn expander ( & mut self , path : & Path ) -> Result < & dylib:: Expander , String > {
51
- Ok ( match self . expanders . entry ( path. to_path_buf ( ) ) {
53
+ let time = metadata ( path)
54
+ . and_then ( |it| it. modified ( ) )
55
+ . map_err ( |err| format ! ( "Failed to file metadata for {}: {:?}" , path. display( ) , err) ) ?;
56
+
57
+ Ok ( match self . expanders . entry ( ( path. to_path_buf ( ) , time) ) {
52
58
Entry :: Vacant ( v) => v. insert ( dylib:: Expander :: new ( path) . map_err ( |err| {
53
59
format ! ( "Cannot create expander for {}: {:?}" , path. display( ) , err)
54
60
} ) ?) ,
You can’t perform that action at this time.
0 commit comments