about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-06 13:30:04 +0200
committerGitHub <noreply@github.com>2023-05-06 13:30:04 +0200
commit48e380fa40817c8d2b0f82761d01856aa593afbe (patch)
tree1b1bae1622a6d27709ca3e9b3b2911864d0268c1
parent8ed5d5de3d4e2cf94ddd00cee922d8533d23c1dd (diff)
parent34a71f67d1e28fe0bf13593e26b682d097678875 (diff)
downloadrust-48e380fa40817c8d2b0f82761d01856aa593afbe.tar.gz
rust-48e380fa40817c8d2b0f82761d01856aa593afbe.zip
Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkin
Make the BUG_REPORT_URL configurable by tools

This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

I haven't changed clippy in case they want to make the change upstream instead of the subtree, but
I'm happy to do so here if the maintainers want - cc ````@rust-lang/clippy````

Fixes https://github.com/rust-lang/rust/issues/109486.
-rw-r--r--src/bin/main.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs
index be64559e877..47846424b06 100644
--- a/src/bin/main.rs
+++ b/src/bin/main.rs
@@ -1,3 +1,5 @@
+#![feature(rustc_private)]
+
 use anyhow::{format_err, Result};
 
 use io::Error as IoError;
@@ -19,7 +21,14 @@ use crate::rustfmt::{
     FormatReportFormatterBuilder, Input, Session, Verbosity,
 };
 
+const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rustfmt/issues/new?labels=bug";
+
+// N.B. these crates are loaded from the sysroot, so they need extern crate.
+extern crate rustc_driver;
+
 fn main() {
+    rustc_driver::install_ice_hook(BUG_REPORT_URL, |_| ());
+
     env_logger::Builder::from_env("RUSTFMT_LOG").init();
     let opts = make_opts();