1
1
//! List of the unstable feature gates.
2
2
3
3
use std:: path:: PathBuf ;
4
+ use std:: time:: { SystemTime , UNIX_EPOCH } ;
4
5
5
6
use rustc_data_structures:: fx:: FxHashSet ;
6
7
use rustc_span:: { Span , Symbol , sym} ;
@@ -681,11 +682,13 @@ impl Features {
681
682
) -> Result < ( ) , Box < dyn std:: error:: Error > > {
682
683
#[ derive( serde:: Serialize ) ]
683
684
struct LibFeature {
685
+ timestamp : u128 ,
684
686
symbol : String ,
685
687
}
686
688
687
689
#[ derive( serde:: Serialize ) ]
688
690
struct LangFeature {
691
+ timestamp : u128 ,
689
692
symbol : String ,
690
693
since : Option < String > ,
691
694
}
@@ -699,10 +702,20 @@ impl Features {
699
702
let metrics_file = std:: fs:: File :: create ( metrics_path) ?;
700
703
let metrics_file = std:: io:: BufWriter :: new ( metrics_file) ;
701
704
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
+
702
712
let lib_features = self
703
713
. enabled_lib_features
704
714
. 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
+ } )
706
719
. collect ( ) ;
707
720
708
721
let lang_features = self
@@ -711,6 +724,7 @@ impl Features {
711
724
. map ( |EnabledLangFeature { gate_name, stable_since, .. } | LangFeature {
712
725
symbol : gate_name. to_string ( ) ,
713
726
since : stable_since. map ( |since| since. to_string ( ) ) ,
727
+ timestamp : now ( ) ,
714
728
} )
715
729
. collect ( ) ;
716
730
0 commit comments