File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1205,9 +1205,12 @@ pub fn ct_token_map<StorageT: Display + ToTokens>(
12051205 let timestamp = env ! ( "VERGEN_BUILD_TIMESTAMP" ) ;
12061206 let mod_ident = format_ident ! ( "{}" , mod_name) ;
12071207 write ! ( outs, "// lrlex build time: {}\n \n " , quote!( #timestamp) , ) . ok ( ) ;
1208- let tokens = & token_map
1209- . borrow ( )
1210- . iter ( )
1208+ // Sort the tokens so that they're always in the same order.
1209+ // This will prevent unneeded rebuilds.
1210+ let mut token_map_sorted = Vec :: from_iter ( token_map. borrow ( ) . iter ( ) ) ;
1211+ token_map_sorted. sort_by_key ( |( k, _) | * k) ;
1212+ let tokens = & token_map_sorted
1213+ . into_iter ( )
12111214 . map ( |( k, id) | {
12121215 let name = match rename_map {
12131216 Some ( rmap) => * rmap. get ( k. as_str ( ) ) . unwrap_or ( & k. as_str ( ) ) ,
You can’t perform that action at this time.
0 commit comments