@@ -76,7 +76,7 @@ pub const EXIT_SUCCESS: i32 = 0;
76
76
pub const EXIT_FAILURE : i32 = 1 ;
77
77
78
78
const BUG_REPORT_URL : & str = "https://github.com/rust-lang/rust/issues/new\
79
- ?labels=C-bug%2C+I -ICE%2C+T -compiler&template=ice.md ";
79
+ ?labels=C-bug%2CI -ICE%2CT -compiler&template=ice.yaml ";
80
80
81
81
const ICE_REPORT_COMPILER_FLAGS : & [ & str ] = & [ "-Z" , "-C" , "--crate-type" ] ;
82
82
@@ -1199,21 +1199,25 @@ fn write_ice_to_disk(info: &panic::PanicInfo<'_>) -> Result<(String, String), Ic
1199
1199
let now = chrono:: UTC :: now ( ) ;
1200
1200
let file_now = now. format ( "%Y-%m-%d_%H:%M:%S" ) ;
1201
1201
let now = now. format ( "%Y-%m-%d %H:%M:%S" ) ;
1202
- let path = format ! ( "rustc-ice-context-{file_now}.txt" ) ;
1202
+ let mut path = std:: env:: current_dir ( ) ?;
1203
+ path. push ( format ! ( "rustc-ice-context-{file_now}.txt" ) ) ;
1203
1204
let mut file = std:: fs:: File :: create ( & path) ?;
1204
- writeln ! (
1205
- file ,
1206
- "rustc {}{} running on {} at {now}" ,
1205
+ let ( llvm_major , llvm_minor , llvm_dot ) = rustc_codegen_llvm :: get_version ( ) ;
1206
+ let version = format ! (
1207
+ "rustc {}{} running on {} at {now} with LLVM {llvm_major}.{llvm_minor}.{llvm_dot} " ,
1207
1208
util:: version_str!( ) . unwrap_or( "unknown_version" ) ,
1208
1209
match ( option_env!( "CFG_VER_HASH" ) , option_env!( "CFG_VER_DATE" ) ) {
1209
1210
( Some ( hash) , Some ( date) ) => format!( " ({hash} - {date})" ) ,
1210
1211
( Some ( val) , None ) | ( None , Some ( val) ) => format!( " ({val})" ) ,
1211
1212
( None , None ) => String :: new( ) ,
1212
1213
} ,
1213
1214
config:: host_triple( ) ,
1214
- ) ?;
1215
- args. push ( ( "version" , util:: version_str!( ) . unwrap_or ( "unknown_version" ) ) ) ;
1216
- args. push ( ( "platform" , config:: host_triple ( ) ) ) ;
1215
+ ) ;
1216
+
1217
+ writeln ! ( file, "{}" , version) ?;
1218
+ args. push ( ( "version" , version. as_str ( ) ) ) ;
1219
+ let backtrace_msg = format ! ( "please include the contents of `{}` here" , path. display( ) ) ;
1220
+ args. push ( ( "backtrace" , & backtrace_msg) ) ;
1217
1221
1218
1222
if let Some ( ( flags, excluded_cargo_defaults) ) = extra_compiler_flags ( ) {
1219
1223
writeln ! ( file, "compiler flags:" ) ?;
@@ -1243,15 +1247,7 @@ fn write_ice_to_disk(info: &panic::PanicInfo<'_>) -> Result<(String, String), Ic
1243
1247
}
1244
1248
1245
1249
writeln ! ( file, "" ) ?;
1246
- let capture = capture. frames ( ) . iter ( ) . map ( |frame| {
1247
- format ! ( "{:?}" , frame)
1248
- } ) . collect :: < String > ( ) ;
1249
1250
writeln ! ( file, "{capture}" ) ?;
1250
- text. push_str ( & format ! ( "{capture}" ) ) ;
1251
- args. push ( ( "backtrace" , & text) ) ;
1252
-
1253
- println ! ( "{}" , text) ;
1254
- println ! ( "{}" , urlqstring:: QueryParams :: from( args) . stringify( ) ) ;
1255
1251
1256
1252
// Be careful relying on global state here: this code is called from
1257
1253
// a panic hook, which means that the global `Handler` may be in a weird
@@ -1280,7 +1276,10 @@ fn write_ice_to_disk(info: &panic::PanicInfo<'_>) -> Result<(String, String), Ic
1280
1276
writeln ! ( file, "end of query stack" ) ?;
1281
1277
Ok ( ( ) )
1282
1278
} ) ?;
1283
- Ok ( ( path, String :: new ( ) ) )
1279
+ Ok ( (
1280
+ path. display ( ) . to_string ( ) ,
1281
+ format ! ( "{BUG_REPORT_URL}&{}" , urlqstring:: QueryParams :: from( args) . stringify( ) ) ,
1282
+ ) )
1284
1283
}
1285
1284
1286
1285
static DEFAULT_HOOK : LazyLock < Box < dyn Fn ( & panic:: PanicInfo < ' _ > ) + Sync + Send + ' static > > =
@@ -1327,7 +1326,11 @@ static DEFAULT_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send +
1327
1326
///
1328
1327
/// When `install_ice_hook` is called, this function will be called as the panic
1329
1328
/// hook.
1330
- pub fn report_ice ( info : & panic:: PanicInfo < ' _ > , bug_report_url : & str , reported_ice : Option < ( String , String ) > ) {
1329
+ pub fn report_ice (
1330
+ info : & panic:: PanicInfo < ' _ > ,
1331
+ bug_report_url : & str ,
1332
+ reported_ice : Option < ( String , String ) > ,
1333
+ ) {
1331
1334
let fallback_bundle =
1332
1335
rustc_errors:: fallback_fluent_bundle ( rustc_errors:: DEFAULT_LOCALE_RESOURCES , false ) ;
1333
1336
let emitter = Box :: new ( rustc_errors:: emitter:: EmitterWriter :: stderr (
@@ -1355,11 +1358,12 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str, reported_ic
1355
1358
handler. emit_diagnostic ( & mut d) ;
1356
1359
}
1357
1360
1358
- let xs: Vec < Cow < ' static , str > > = if let Some ( ( path, url) ) = & reported_ice {
1361
+ let xs: Vec < Cow < ' static , str > > = if let Some ( ( path, custom_url) ) = & reported_ice {
1362
+ let link = format ! ( "\x1b ]8;;{custom_url}\x1b \\ {bug_report_url}\x1b ]8;;\x1b \\ " ) ;
1363
+ let path = format ! ( "\x1b ]8;;file://{path}\x1b \\ {path}\x1b ]8;;\x1b \\ " ) ;
1359
1364
vec ! [
1360
1365
format!( "all necessary context about this bug was written to `{path}`" ) . into( ) ,
1361
- format!( "we would appreciate a bug report with this context at <{url}>" )
1362
- . into( ) ,
1366
+ format!( "we would appreciate a bug report with this context at {link}" ) . into( ) ,
1363
1367
]
1364
1368
} else {
1365
1369
let mut xs = vec ! [
0 commit comments