Skip to content

Commit 34a71f6

Browse files
committed
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. - Switch clippy to the new hook This also adds a `extra_info` callback so clippy can include its own version number, which differs from rustc's. - Call `install_ice_hook` in rustfmt
1 parent f4c9b4c commit 34a71f6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bin/main.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(rustc_private)]
2+
13
use anyhow::{format_err, Result};
24

35
use io::Error as IoError;
@@ -19,7 +21,14 @@ use crate::rustfmt::{
1921
FormatReportFormatterBuilder, Input, Session, Verbosity,
2022
};
2123

24+
const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rustfmt/issues/new?labels=bug";
25+
26+
// N.B. these crates are loaded from the sysroot, so they need extern crate.
27+
extern crate rustc_driver;
28+
2229
fn main() {
30+
rustc_driver::install_ice_hook(BUG_REPORT_URL, |_| ());
31+
2332
env_logger::Builder::from_env("RUSTFMT_LOG").init();
2433
let opts = make_opts();
2534

0 commit comments

Comments
 (0)