about summary refs log tree commit diff
path: root/compiler/rustc_driver/src/lib.rs
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-08-19 14:48:15 +0100
committerDavid Wood <david.wood@huawei.com>2023-01-30 17:11:35 +0000
commit2575b1abc97e1352b307163ac7de2142aded22a5 (patch)
tree7990ade06ccd75cdcbb3a8c9a07c6d255c60cf22 /compiler/rustc_driver/src/lib.rs
parentd45004806d04225bab2f86076bcc6d6a8862b2a9 (diff)
downloadrust-2575b1abc97e1352b307163ac7de2142aded22a5.tar.gz
rust-2575b1abc97e1352b307163ac7de2142aded22a5.zip
session: diagnostic migration lint on more fns
Apply the diagnostic migration lint to more functions on `Session`.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_driver/src/lib.rs')
-rw-r--r--compiler/rustc_driver/src/lib.rs26
1 files changed, 8 insertions, 18 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index ccefd6adaf1..02e0b042ad2 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -43,7 +43,6 @@ use rustc_span::source_map::{FileLoader, FileName};
 use rustc_span::symbol::sym;
 use rustc_target::json::ToJson;
 
-use std::borrow::Cow;
 use std::cmp::max;
 use std::env;
 use std::ffi::OsString;
@@ -1205,29 +1204,20 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
         handler.emit_diagnostic(&mut d);
     }
 
-    let mut xs: Vec<Cow<'static, str>> = vec![
-        "the compiler unexpectedly panicked. this is a bug.".into(),
-        format!("we would appreciate a bug report: {bug_report_url}").into(),
-        format!(
-            "rustc {} running on {}",
-            util::version_str!().unwrap_or("unknown_version"),
-            config::host_triple()
-        )
-        .into(),
-    ];
+    handler.emit_note(session_diagnostics::Ice);
+    handler.emit_note(session_diagnostics::IceBugReport { bug_report_url });
+    handler.emit_note(session_diagnostics::IceVersion {
+        version: util::version_str!().unwrap_or("unknown_version"),
+        triple: config::host_triple(),
+    });
 
     if let Some((flags, excluded_cargo_defaults)) = extra_compiler_flags() {
-        xs.push(format!("compiler flags: {}", flags.join(" ")).into());
-
+        handler.emit_note(session_diagnostics::IceFlags { flags: flags.join(" ") });
         if excluded_cargo_defaults {
-            xs.push("some of the compiler flags provided by cargo are hidden".into());
+            handler.emit_note(session_diagnostics::IceExcludeCargoDefaults);
         }
     }
 
-    for note in &xs {
-        handler.note_without_error(note.as_ref());
-    }
-
     // If backtraces are enabled, also print the query stack
     let backtrace = env::var_os("RUST_BACKTRACE").map_or(false, |x| &x != "0");