File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -493,9 +493,14 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
493493 // Check for future incompatibility lints and issue a stronger warning.
494494 let lints = sess. lint_store . borrow ( ) ;
495495 if let Some ( future_incompatible) = lints. future_incompatible ( LintId :: of ( lint) ) {
496+ let future = if let Some ( epoch) = future_incompatible. epoch {
497+ format ! ( "the {} epoch" , epoch)
498+ } else {
499+ "a future release" . to_owned ( )
500+ } ;
496501 let explanation = format ! ( "this was previously accepted by the compiler \
497502 but is being phased out; \
498- it will become a hard error in a future release!" ) ;
503+ it will become a hard error in {}!" , future ) ;
499504 let citation = format ! ( "for more information, see {}" ,
500505 future_incompatible. reference) ;
501506 err. warn ( & explanation) ;
Original file line number Diff line number Diff line change 88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11+ use std:: fmt;
1112use std:: str:: FromStr ;
1213
1314/// The epoch of the compiler (RFC 2052)
@@ -37,12 +38,13 @@ pub enum Epoch {
3738// must be in order from oldest to newest
3839pub const ALL_EPOCHS : & [ Epoch ] = & [ Epoch :: Epoch2015 , Epoch :: Epoch2018 ] ;
3940
40- impl ToString for Epoch {
41- fn to_string ( & self ) -> String {
42- match * self {
43- Epoch :: Epoch2015 => "2015" . into ( ) ,
44- Epoch :: Epoch2018 => "2018" . into ( ) ,
45- }
41+ impl fmt:: Display for Epoch {
42+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
43+ let s = match * self {
44+ Epoch :: Epoch2015 => "2015" ,
45+ Epoch :: Epoch2018 => "2018" ,
46+ } ;
47+ write ! ( f, "{}" , s)
4648 }
4749}
4850
You can’t perform that action at this time.
0 commit comments