File tree 2 files changed +14
-7
lines changed
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,
493
493
// Check for future incompatibility lints and issue a stronger warning.
494
494
let lints = sess. lint_store . borrow ( ) ;
495
495
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
+ } ;
496
501
let explanation = format ! ( "this was previously accepted by the compiler \
497
502
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 ) ;
499
504
let citation = format ! ( "for more information, see {}" ,
500
505
future_incompatible. reference) ;
501
506
err. warn ( & explanation) ;
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ use std:: fmt;
11
12
use std:: str:: FromStr ;
12
13
13
14
/// The epoch of the compiler (RFC 2052)
@@ -37,12 +38,13 @@ pub enum Epoch {
37
38
// must be in order from oldest to newest
38
39
pub const ALL_EPOCHS : & [ Epoch ] = & [ Epoch :: Epoch2015 , Epoch :: Epoch2018 ] ;
39
40
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)
46
48
}
47
49
}
48
50
You can’t perform that action at this time.
0 commit comments