11//! List of the unstable feature gates. 
22
33use  std:: path:: PathBuf ; 
4+ use  std:: time:: { SystemTime ,  UNIX_EPOCH } ; 
45
56use  rustc_data_structures:: fx:: FxHashSet ; 
67use  rustc_span:: { Span ,  Symbol ,  sym} ; 
@@ -681,11 +682,13 @@ impl Features {
681682    )  -> Result < ( ) ,  Box < dyn  std:: error:: Error > >  { 
682683        #[ derive( serde:: Serialize ) ]  
683684        struct  LibFeature  { 
685+             timestamp :  u128 , 
684686            symbol :  String , 
685687        } 
686688
687689        #[ derive( serde:: Serialize ) ]  
688690        struct  LangFeature  { 
691+             timestamp :  u128 , 
689692            symbol :  String , 
690693            since :  Option < String > , 
691694        } 
@@ -699,10 +702,20 @@ impl Features {
699702        let  metrics_file = std:: fs:: File :: create ( metrics_path) ?; 
700703        let  metrics_file = std:: io:: BufWriter :: new ( metrics_file) ; 
701704
705+         let  now = || { 
706+             SystemTime :: now ( ) 
707+                 . duration_since ( UNIX_EPOCH ) 
708+                 . expect ( "system time should always be greater than the unix epoch" ) 
709+                 . as_nanos ( ) 
710+         } ; 
711+ 
702712        let  lib_features = self 
703713            . enabled_lib_features 
704714            . iter ( ) 
705-             . map ( |EnabledLibFeature  {  gate_name,  .. } | LibFeature  {  symbol :  gate_name. to_string ( )  } ) 
715+             . map ( |EnabledLibFeature  {  gate_name,  .. } | LibFeature  { 
716+                 symbol :  gate_name. to_string ( ) , 
717+                 timestamp :  now ( ) , 
718+             } ) 
706719            . collect ( ) ; 
707720
708721        let  lang_features = self 
@@ -711,6 +724,7 @@ impl Features {
711724            . map ( |EnabledLangFeature  {  gate_name,  stable_since,  .. } | LangFeature  { 
712725                symbol :  gate_name. to_string ( ) , 
713726                since :  stable_since. map ( |since| since. to_string ( ) ) , 
727+                 timestamp :  now ( ) , 
714728            } ) 
715729            . collect ( ) ; 
716730
0 commit comments