@@ -28,8 +28,8 @@ use std::io::{self, IsTerminal, Read, Write};
28
28
use std:: panic:: { self , PanicHookInfo , catch_unwind} ;
29
29
use std:: path:: { Path , PathBuf } ;
30
30
use std:: process:: { self , Command , Stdio } ;
31
+ use std:: sync:: OnceLock ;
31
32
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
32
- use std:: sync:: { Arc , OnceLock } ;
33
33
use std:: time:: { Instant , SystemTime } ;
34
34
use std:: { env, str} ;
35
35
@@ -214,18 +214,11 @@ pub struct RunCompiler<'a> {
214
214
file_loader: Option <Box <dyn FileLoader + Send + Sync >>,
215
215
make_codegen_backend:
216
216
Option <Box <dyn FnOnce ( & config:: Options ) -> Box <dyn CodegenBackend > + Send >>,
217
- using_internal_features: Arc <std:: sync:: atomic:: AtomicBool >,
218
217
}
219
218
220
219
impl <' a> RunCompiler <' a> {
221
220
pub fn new( at_args: & ' a [ String ] , callbacks: & ' a mut ( dyn Callbacks + Send ) ) -> Self {
222
- Self {
223
- at_args,
224
- callbacks,
225
- file_loader: None ,
226
- make_codegen_backend: None ,
227
- using_internal_features: Arc :: default ( ) ,
228
- }
221
+ Self { at_args, callbacks, file_loader: None , make_codegen_backend: None }
229
222
}
230
223
231
224
/// Set a custom codegen backend.
@@ -257,23 +250,9 @@ impl<'a> RunCompiler<'a> {
257
250
self
258
251
}
259
252
260
- /// Set the session-global flag that checks whether internal features have been used,
261
- /// suppressing the message about submitting an issue in ICEs when enabled.
262
- #[ must_use]
263
- pub fn set_using_internal_features( mut self , using_internal_features: Arc <AtomicBool >) -> Self {
264
- self . using_internal_features = using_internal_features;
265
- self
266
- }
267
-
268
253
/// Parse args and run the compiler.
269
254
pub fn run( self ) {
270
- run_compiler(
271
- self . at_args,
272
- self . callbacks,
273
- self . file_loader,
274
- self . make_codegen_backend,
275
- self . using_internal_features,
276
- ) ;
255
+ run_compiler( self . at_args, self . callbacks, self . file_loader, self . make_codegen_backend) ;
277
256
}
278
257
}
279
258
@@ -284,7 +263,6 @@ fn run_compiler(
284
263
make_codegen_backend: Option <
285
264
Box <dyn FnOnce ( & config:: Options ) -> Box <dyn CodegenBackend > + Send >,
286
265
>,
287
- using_internal_features: Arc <std:: sync:: atomic:: AtomicBool >,
288
266
) {
289
267
let mut default_early_dcx = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
290
268
@@ -331,7 +309,7 @@ fn run_compiler(
331
309
override_queries: None ,
332
310
make_codegen_backend,
333
311
registry: diagnostics_registry( ) ,
334
- using_internal_features,
312
+ using_internal_features: & USING_INTERNAL_FEATURES ,
335
313
expanded_args: args,
336
314
} ;
337
315
@@ -1350,6 +1328,8 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option<Pat
1350
1328
} )
1351
1329
}
1352
1330
1331
+ pub static USING_INTERNAL_FEATURES : AtomicBool = AtomicBool :: new( false ) ;
1332
+
1353
1333
/// Installs a panic hook that will print the ICE message on unexpected panics.
1354
1334
///
1355
1335
/// The hook is intended to be useable even by external tools. You can pass a custom
@@ -1360,15 +1340,8 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option<Pat
1360
1340
/// If you have no extra info to report, pass the empty closure `|_| ()` as the argument to
1361
1341
/// extra_info.
1362
1342
///
1363
- /// Returns a flag that can be set to disable the note for submitting a bug. This can be passed to
1364
- /// [`RunCompiler::set_using_internal_features`] to let macro expansion set it when encountering
1365
- /// internal features.
1366
- ///
1367
1343
/// A custom rustc driver can skip calling this to set up a custom ICE hook.
1368
- pub fn install_ice_hook(
1369
- bug_report_url: & ' static str ,
1370
- extra_info: fn ( & DiagCtxt ) ,
1371
- ) -> Arc <AtomicBool > {
1344
+ pub fn install_ice_hook( bug_report_url: & ' static str , extra_info: fn ( & DiagCtxt ) ) {
1372
1345
// If the user has not explicitly overridden "RUST_BACKTRACE", then produce
1373
1346
// full backtraces. When a compiler ICE happens, we want to gather
1374
1347
// as much information as possible to present in the issue opened
@@ -1385,8 +1358,6 @@ pub fn install_ice_hook(
1385
1358
}
1386
1359
}
1387
1360
1388
- let using_internal_features = Arc :: new( std:: sync:: atomic:: AtomicBool :: default ( ) ) ;
1389
- let using_internal_features_hook = Arc :: clone( & using_internal_features) ;
1390
1361
panic:: update_hook( Box :: new(
1391
1362
move |default_hook: & ( dyn Fn ( & PanicHookInfo <' _>) + Send + Sync + ' static ) ,
1392
1363
info: & PanicHookInfo <' _>| {
@@ -1438,11 +1409,9 @@ pub fn install_ice_hook(
1438
1409
}
1439
1410
1440
1411
// Print the ICE message
1441
- report_ice( info, bug_report_url, extra_info, & using_internal_features_hook ) ;
1412
+ report_ice( info, bug_report_url, extra_info, & USING_INTERNAL_FEATURES ) ;
1442
1413
} ,
1443
1414
) ) ;
1444
-
1445
- using_internal_features
1446
1415
}
1447
1416
1448
1417
/// Prints the ICE message, including query stack, but without backtrace.
@@ -1583,13 +1552,11 @@ pub fn main() -> ! {
1583
1552
init_rustc_env_logger( & early_dcx) ;
1584
1553
signal_handler:: install( ) ;
1585
1554
let mut callbacks = TimePassesCallbacks :: default ( ) ;
1586
- let using_internal_features = install_ice_hook( DEFAULT_BUG_REPORT_URL , |_| ( ) ) ;
1555
+ install_ice_hook( DEFAULT_BUG_REPORT_URL , |_| ( ) ) ;
1587
1556
install_ctrlc_handler( ) ;
1588
1557
1589
1558
let exit_code = catch_with_exit_code( || {
1590
- RunCompiler :: new( & args:: raw_args( & early_dcx) ?, & mut callbacks)
1591
- . set_using_internal_features( using_internal_features)
1592
- . run( ) ;
1559
+ RunCompiler :: new( & args:: raw_args( & early_dcx) ?, & mut callbacks) . run( ) ;
1593
1560
Ok ( ( ) )
1594
1561
} ) ;
1595
1562
0 commit comments