File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ session_feature_diagnostic_help =
2525 add `#![feature({ $feature } )]` to the crate attributes to enable
2626
2727session_feature_suggest_upgrade_compiler =
28- this compiler is version { $version } built on { $date } , consider upgrading?
28+ this compiler was built on { $date } ; consider upgrading if it is out of date
2929
3030session_file_is_not_writeable = output file { $file } is not writeable -- check its permissions
3131
Original file line number Diff line number Diff line change @@ -34,16 +34,14 @@ pub struct FeatureDiagnosticForIssue {
3434#[ derive( Subdiagnostic ) ]
3535#[ note( session_feature_suggest_upgrade_compiler) ]
3636pub struct SuggestUpgradeCompiler {
37- version : & ' static str ,
3837 date : & ' static str ,
3938}
4039
4140impl SuggestUpgradeCompiler {
42- pub fn new ( ) -> Self {
43- let version = option_env ! ( "CFG_VERSION" ) . unwrap_or ( "unknown" ) ;
44- let date = option_env ! ( "CFG_VER_DATE" ) . unwrap_or ( "unknown" ) ;
41+ pub fn new ( ) -> Option < Self > {
42+ let date = option_env ! ( "CFG_VER_DATE" ) ?;
4543
46- Self { version , date }
44+ Some ( Self { date } )
4745 }
4846}
4947
Original file line number Diff line number Diff line change @@ -185,7 +185,9 @@ pub fn add_feature_diagnostics_for_issue(
185185 err. subdiagnostic ( FeatureDiagnosticHelp { feature } ) ;
186186 }
187187
188- err. subdiagnostic ( SuggestUpgradeCompiler :: new ( ) ) ;
188+ if let Some ( suggestion) = SuggestUpgradeCompiler :: new ( ) {
189+ err. subdiagnostic ( suggestion) ;
190+ }
189191 }
190192}
191193
You can’t perform that action at this time.
0 commit comments