@@ -140,12 +140,6 @@ pub const EXIT_FAILURE: i32 = 1;
140
140
pub const DEFAULT_BUG_REPORT_URL : & str = "https://github.com/rust-lang/rust/issues/new\
141
141
?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md";
142
142
143
- const ICE_REPORT_COMPILER_FLAGS : & [ & str ] = & [ "-Z" , "-C" , "--crate-type" ] ;
144
-
145
- const ICE_REPORT_COMPILER_FLAGS_EXCLUDE : & [ & str ] = & [ "metadata" , "extra-filename" ] ;
146
-
147
- const ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE : & [ & str ] = & [ "incremental" ] ;
148
-
149
143
pub fn abort_on_err<T >( result: Result <T , ErrorGuaranteed >, sess: & Session ) -> T {
150
144
match result {
151
145
Err ( ..) => {
@@ -1250,47 +1244,6 @@ fn parse_crate_attrs<'a>(sess: &'a Session) -> PResult<'a, ast::AttrVec> {
1250
1244
}
1251
1245
}
1252
1246
1253
- /// Gets a list of extra command-line flags provided by the user, as strings.
1254
- ///
1255
- /// This function is used during ICEs to show more information useful for
1256
- /// debugging, since some ICEs only happens with non-default compiler flags
1257
- /// (and the users don't always report them).
1258
- fn extra_compiler_flags( ) -> Option <( Vec <String >, bool ) > {
1259
- let mut args = env:: args_os( ) . map( |arg| arg. to_string_lossy( ) . to_string( ) ) . peekable( ) ;
1260
-
1261
- let mut result = Vec :: new( ) ;
1262
- let mut excluded_cargo_defaults = false ;
1263
- while let Some ( arg) = args. next( ) {
1264
- if let Some ( a) = ICE_REPORT_COMPILER_FLAGS . iter( ) . find( |a| arg. starts_with( * a) ) {
1265
- let content = if arg. len( ) == a. len( ) {
1266
- // A space-separated option, like `-C incremental=foo` or `--crate-type rlib`
1267
- match args. next( ) {
1268
- Some ( arg) => arg. to_string( ) ,
1269
- None => continue ,
1270
- }
1271
- } else if arg. get( a. len( ) ..a. len( ) + 1 ) == Some ( "=" ) {
1272
- // An equals option, like `--crate-type=rlib`
1273
- arg[ a. len( ) + 1 ..] . to_string( )
1274
- } else {
1275
- // A non-space option, like `-Cincremental=foo`
1276
- arg[ a. len( ) ..] . to_string( )
1277
- } ;
1278
- let option = content. split_once( '=' ) . map( |s| s. 0 ) . unwrap_or( & content) ;
1279
- if ICE_REPORT_COMPILER_FLAGS_EXCLUDE . iter( ) . any( |exc| option == * exc) {
1280
- excluded_cargo_defaults = true ;
1281
- } else {
1282
- result. push( a. to_string( ) ) ;
1283
- match ICE_REPORT_COMPILER_FLAGS_STRIP_VALUE . iter( ) . find( |s| option == * * s) {
1284
- Some ( s) => result. push( format!( "{s}=[REDACTED]" ) ) ,
1285
- None => result. push( content) ,
1286
- }
1287
- }
1288
- }
1289
- }
1290
-
1291
- if !result. is_empty( ) { Some ( ( result, excluded_cargo_defaults) ) } else { None }
1292
- }
1293
-
1294
1247
/// Runs a closure and catches unwinds triggered by fatal errors.
1295
1248
///
1296
1249
/// The compiler currently unwinds with a special sentinel value to abort
@@ -1449,7 +1402,7 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str, extra_info:
1449
1402
None
1450
1403
} ;
1451
1404
1452
- if let Some ( ( flags, excluded_cargo_defaults) ) = extra_compiler_flags( ) {
1405
+ if let Some ( ( flags, excluded_cargo_defaults) ) = rustc_session :: utils :: extra_compiler_flags( ) {
1453
1406
handler. emit_note( session_diagnostics:: IceFlags { flags: flags. join( " " ) } ) ;
1454
1407
if excluded_cargo_defaults {
1455
1408
handler. emit_note( session_diagnostics:: IceExcludeCargoDefaults ) ;
0 commit comments