11//! List of the unstable feature gates.
22
3- use std:: path:: PathBuf ;
3+ use std:: {
4+ path:: PathBuf ,
5+ time:: { SystemTime , UNIX_EPOCH } ,
6+ } ;
47
58use rustc_data_structures:: fx:: FxHashSet ;
69use rustc_span:: { Span , Symbol , sym} ;
@@ -681,11 +684,13 @@ impl Features {
681684 ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
682685 #[ derive( serde:: Serialize ) ]
683686 struct LibFeature {
687+ timestamp : u128 ,
684688 symbol : String ,
685689 }
686690
687691 #[ derive( serde:: Serialize ) ]
688692 struct LangFeature {
693+ timestamp : u128 ,
689694 symbol : String ,
690695 since : Option < String > ,
691696 }
@@ -699,10 +704,20 @@ impl Features {
699704 let metrics_file = std:: fs:: File :: create ( metrics_path) ?;
700705 let metrics_file = std:: io:: BufWriter :: new ( metrics_file) ;
701706
707+ let now = || {
708+ SystemTime :: now ( )
709+ . duration_since ( UNIX_EPOCH )
710+ . expect ( "system time should always be greater than the unix epoch" )
711+ . as_nanos ( )
712+ } ;
713+
702714 let lib_features = self
703715 . enabled_lib_features
704716 . iter ( )
705- . map ( |EnabledLibFeature { gate_name, .. } | LibFeature { symbol : gate_name. to_string ( ) } )
717+ . map ( |EnabledLibFeature { gate_name, .. } | LibFeature {
718+ symbol : gate_name. to_string ( ) ,
719+ timestamp : now ( ) ,
720+ } )
706721 . collect ( ) ;
707722
708723 let lang_features = self
@@ -711,6 +726,7 @@ impl Features {
711726 . map ( |EnabledLangFeature { gate_name, stable_since, .. } | LangFeature {
712727 symbol : gate_name. to_string ( ) ,
713728 since : stable_since. map ( |since| since. to_string ( ) ) ,
729+ timestamp : now ( ) ,
714730 } )
715731 . collect ( ) ;
716732
0 commit comments