about summary refs log tree commit diff
path: root/compiler/rustc_session/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_session/src/errors.rs')
-rw-r--r--compiler/rustc_session/src/errors.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs
index 24782b41cc8..21a206798af 100644
--- a/compiler/rustc_session/src/errors.rs
+++ b/compiler/rustc_session/src/errors.rs
@@ -1,6 +1,5 @@
 use std::num::NonZeroU32;
 
-use crate::parse::ParseSess;
 use rustc_ast::token;
 use rustc_ast::util::literal::LitError;
 use rustc_errors::{
@@ -10,6 +9,8 @@ use rustc_macros::Diagnostic;
 use rustc_span::{BytePos, Span, Symbol};
 use rustc_target::spec::{SplitDebuginfo, StackProtector, TargetTriple};
 
+use crate::parse::ParseSess;
+
 pub struct FeatureGateError {
     pub span: MultiSpan,
     pub explain: DiagnosticMessage,
@@ -33,16 +34,18 @@ pub struct FeatureDiagnosticForIssue {
 #[derive(Subdiagnostic)]
 #[note(session_feature_suggest_upgrade_compiler)]
 pub struct SuggestUpgradeCompiler {
-    version: &'static str,
     date: &'static str,
 }
 
 impl SuggestUpgradeCompiler {
-    pub fn new() -> Self {
-        let version = option_env!("CFG_VERSION").unwrap_or("unknown");
-        let date = option_env!("CFG_VER_DATE").unwrap_or("unknown");
+    pub fn ui_testing() -> Self {
+        Self { date: "YYYY-MM-DD" }
+    }
+
+    pub fn new() -> Option<Self> {
+        let date = option_env!("CFG_VER_DATE")?;
 
-        Self { version, date }
+        Some(Self { date })
     }
 }