about summary refs log tree commit diff
path: root/compiler/rustc_session/src/errors.rs
diff options
context:
space:
mode:
authorGeorge-lewis <george-lewis@user.noreply.github.com>2024-01-10 00:37:30 -0500
committerGeorge-lewis <george-lewis@user.noreply.github.com>2024-01-13 12:11:13 -0500
commit36a69e9d39b3dd49fefa2f84b2787a50230e0a32 (patch)
treebf367cb5d5cd412e5c8a5602bdadc1a1d9b3185c /compiler/rustc_session/src/errors.rs
parentb55faad3149ecf196a498ea1c0cf6195f22c9d89 (diff)
downloadrust-36a69e9d39b3dd49fefa2f84b2787a50230e0a32.tar.gz
rust-36a69e9d39b3dd49fefa2f84b2787a50230e0a32.zip
Add check for ui_testing via promoting parameters from `ParseSess` to `Session`
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 })
     }
 }