driver: unconditionally show update nightly hint
This commit is contained in:
parent
2805aedf9f
commit
c7e77befd8
@ -1,10 +1,7 @@
|
||||
driver_impl_ice = the compiler unexpectedly panicked. this is a bug.
|
||||
driver_impl_ice_bug_report = we would appreciate a bug report: {$bug_report_url}
|
||||
driver_impl_ice_bug_report_internal_feature = using internal features is not supported and expected to cause internal compiler errors when used incorrectly
|
||||
driver_impl_ice_bug_report_outdated =
|
||||
it seems that this compiler `{$version}` is outdated, a newer nightly should have been released in the meantime
|
||||
.update = please consider running `rustup update nightly` to update the nightly channel and check if this problem still persists
|
||||
.url = if the problem still persists, we would appreciate a bug report: {$bug_report_url}
|
||||
driver_impl_ice_bug_report_update_note = please make sure that you have updated to the latest nightly
|
||||
driver_impl_ice_exclude_cargo_defaults = some of the compiler flags provided by cargo are hidden
|
||||
|
||||
driver_impl_ice_flags = compiler flags: {$flags}
|
||||
|
@ -61,7 +61,7 @@
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use std::time::{Instant, SystemTime};
|
||||
use time::{Date, OffsetDateTime, Time};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[allow(unused_macros)]
|
||||
macro do_not_use_print($($t:tt)*) {
|
||||
@ -1385,9 +1385,6 @@ pub fn install_ice_hook(
|
||||
using_internal_features
|
||||
}
|
||||
|
||||
const DATE_FORMAT: &[time::format_description::FormatItem<'static>] =
|
||||
&time::macros::format_description!("[year]-[month]-[day]");
|
||||
|
||||
/// Prints the ICE message, including query stack, but without backtrace.
|
||||
///
|
||||
/// The message will point the user at `bug_report_url` to report the ICE.
|
||||
@ -1416,33 +1413,14 @@ fn report_ice(
|
||||
dcx.emit_err(session_diagnostics::Ice);
|
||||
}
|
||||
|
||||
use time::ext::NumericalDuration;
|
||||
|
||||
// Try to hint user to update nightly if applicable when reporting an ICE.
|
||||
// Attempt to calculate when current version was released, and add 12 hours
|
||||
// as buffer. If the current version's release timestamp is older than
|
||||
// the system's current time + 24 hours + 12 hours buffer if we're on
|
||||
// nightly.
|
||||
if let Some("nightly") = option_env!("CFG_RELEASE_CHANNEL")
|
||||
&& let Some(version) = option_env!("CFG_VERSION")
|
||||
&& let Some(ver_date_str) = option_env!("CFG_VER_DATE")
|
||||
&& let Ok(ver_date) = Date::parse(&ver_date_str, DATE_FORMAT)
|
||||
&& let ver_datetime = OffsetDateTime::new_utc(ver_date, Time::MIDNIGHT)
|
||||
&& let system_datetime = OffsetDateTime::from(SystemTime::now())
|
||||
&& system_datetime.checked_sub(36.hours()).is_some_and(|d| d > ver_datetime)
|
||||
&& !using_internal_features.load(std::sync::atomic::Ordering::Relaxed)
|
||||
{
|
||||
dcx.emit_note(session_diagnostics::IceBugReportOutdated {
|
||||
version,
|
||||
bug_report_url,
|
||||
note_update: (),
|
||||
note_url: (),
|
||||
});
|
||||
if using_internal_features.load(std::sync::atomic::Ordering::Relaxed) {
|
||||
dcx.emit_note(session_diagnostics::IceBugReportInternalFeature);
|
||||
} else {
|
||||
if using_internal_features.load(std::sync::atomic::Ordering::Relaxed) {
|
||||
dcx.emit_note(session_diagnostics::IceBugReportInternalFeature);
|
||||
} else {
|
||||
dcx.emit_note(session_diagnostics::IceBugReport { bug_report_url });
|
||||
dcx.emit_note(session_diagnostics::IceBugReport { bug_report_url });
|
||||
|
||||
// Only emit update nightly hint for users on nightly builds.
|
||||
if rustc_feature::UnstableFeatures::from_environment(None).is_nightly_build() {
|
||||
dcx.emit_note(session_diagnostics::UpdateNightlyNote);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,19 +43,12 @@ pub(crate) struct IceBugReport<'a> {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(driver_impl_ice_bug_report_internal_feature)]
|
||||
pub(crate) struct IceBugReportInternalFeature;
|
||||
#[diag(driver_impl_ice_bug_report_update_note)]
|
||||
pub(crate) struct UpdateNightlyNote;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(driver_impl_ice_bug_report_outdated)]
|
||||
pub(crate) struct IceBugReportOutdated<'a> {
|
||||
pub version: &'a str,
|
||||
pub bug_report_url: &'a str,
|
||||
#[note(driver_impl_update)]
|
||||
pub note_update: (),
|
||||
#[note(driver_impl_url)]
|
||||
pub note_url: (),
|
||||
}
|
||||
#[diag(driver_impl_ice_bug_report_internal_feature)]
|
||||
pub(crate) struct IceBugReportInternalFeature;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(driver_impl_ice_version)]
|
||||
|
Loading…
Reference in New Issue
Block a user