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;
2323use ra_proc_macro:: { ExpansionResult , ExpansionTask , ListMacrosResult , ListMacrosTask } ;
2424use std:: {
2525 collections:: { hash_map:: Entry , HashMap } ,
26+ fs:: metadata,
2627 path:: { Path , PathBuf } ,
28+ time:: SystemTime ,
2729} ;
2830
2931#[ derive( Default ) ]
3032pub ( crate ) struct ProcMacroSrv {
31- expanders : HashMap < PathBuf , dylib:: Expander > ,
33+ expanders : HashMap < ( PathBuf , SystemTime ) , dylib:: Expander > ,
3234}
3335
3436impl ProcMacroSrv {
@@ -48,7 +50,11 @@ impl ProcMacroSrv {
4850 }
4951
5052 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) ) {
5258 Entry :: Vacant ( v) => v. insert ( dylib:: Expander :: new ( path) . map_err ( |err| {
5359 format ! ( "Cannot create expander for {}: {:?}" , path. display( ) , err)
5460 } ) ?) ,
You can’t perform that action at this time.
0 commit comments