Skip to content

Commit f513928

Browse files
committed
Auto merge of #116818 - Nilstrieb:stop-submitting-bug-reports, r=wesleywiser
Stop telling people to submit bugs for internal feature ICEs This keeps track of usage of internal features, and changes the message to instead tell them that using internal features is not supported. I thought about several ways to do this but now used the explicit threading of an `Arc<AtomicBool>` through `Session`. This is not exactly incremental-safe, but this is fine, as this is set during macro expansion, which is pre-incremental, and also only affects the output of ICEs, at which point incremental correctness doesn't matter much anyways. See [MCP 620.](rust-lang/compiler-team#596) ![image](https://github.com/rust-lang/rust/assets/48135649/be661f05-b78a-40a9-b01d-81ad2dbdb690)
2 parents 87abc26 + 0a1036d commit f513928

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/bin/miri.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ fn run_compiler(
241241
mut args: Vec<String>,
242242
target_crate: bool,
243243
callbacks: &mut (dyn rustc_driver::Callbacks + Send),
244+
using_internal_features: std::sync::Arc<std::sync::atomic::AtomicBool>
244245
) -> ! {
245246
if target_crate {
246247
// Miri needs a custom sysroot for target crates.
@@ -273,7 +274,8 @@ fn run_compiler(
273274

274275
// Invoke compiler, and handle return code.
275276
let exit_code = rustc_driver::catch_with_exit_code(move || {
276-
rustc_driver::RunCompiler::new(&args, callbacks).run()
277+
rustc_driver::RunCompiler::new(&args, callbacks)
278+
.set_using_internal_features(using_internal_features).run()
277279
});
278280
std::process::exit(exit_code)
279281
}
@@ -295,7 +297,7 @@ fn main() {
295297
// If the environment asks us to actually be rustc, then do that.
296298
if let Some(crate_kind) = env::var_os("MIRI_BE_RUSTC") {
297299
// Earliest rustc setup.
298-
rustc_driver::install_ice_hook(rustc_driver::DEFAULT_BUG_REPORT_URL, |_| ());
300+
let using_internal_features = rustc_driver::install_ice_hook(rustc_driver::DEFAULT_BUG_REPORT_URL, |_| ());
299301
rustc_driver::init_rustc_env_logger(&handler);
300302

301303
let target_crate = if crate_kind == "target" {
@@ -311,11 +313,12 @@ fn main() {
311313
env::args().collect(),
312314
target_crate,
313315
&mut MiriBeRustCompilerCalls { target_crate },
316+
using_internal_features,
314317
)
315318
}
316319

317320
// Add an ICE bug report hook.
318-
rustc_driver::install_ice_hook("https://github.com/rust-lang/miri/issues/new", |_| ());
321+
let using_internal_features = rustc_driver::install_ice_hook("https://github.com/rust-lang/miri/issues/new", |_| ());
319322

320323
// Init loggers the Miri way.
321324
init_early_loggers(&handler);
@@ -578,5 +581,5 @@ fn main() {
578581

579582
debug!("rustc arguments: {:?}", rustc_args);
580583
debug!("crate arguments: {:?}", miri_config.args);
581-
run_compiler(rustc_args, /* target_crate: */ true, &mut MiriCompilerCalls { miri_config })
584+
run_compiler(rustc_args, /* target_crate: */ true, &mut MiriCompilerCalls { miri_config }, using_internal_features)
582585
}

0 commit comments

Comments
 (0)