Skip to content

Commit f4094c8

Browse files
committed
1 parent 63b506a commit f4094c8

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

cargo-dylint/tests/boundary_toolchains.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use tempfile::tempdir;
88
// smoelius: Put recent boundaries first, since they're more likely to cause problems.
99
// smoelius: The relevant PRs and merge commits appear before each boundary.
1010
const BOUNDARIES: &[(&str, &str)] = &[
11+
// https://github.com/rust-lang/rust/pull/112692
12+
// https://github.com/rust-lang/rust/commit/b6144cd843d6eb6acc086797ea37e0c69c892b90
13+
("2023-06-28", "2023-06-29"),
1114
// https://github.com/rust-lang/rust/pull/111748
1215
// https://github.com/rust-lang/rust/commit/70e04bd88d85cab8ed110ace5a278fab106d0ef5
1316
("2023-05-29", "2023-05-30"),

driver/src/lib.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ impl Callbacks {
127127
path.to_string_lossy(),
128128
err
129129
);
130-
rustc_session::early_error(
131-
rustc_session::config::ErrorOutputType::default(),
132-
Box::leak(msg.into_boxed_str()) as &str,
133-
);
130+
early_error(msg);
134131
});
135132

136133
loaded_libs.push(LoadedLibrary { path, lib });
@@ -140,6 +137,24 @@ impl Callbacks {
140137
}
141138
}
142139

140+
#[rustversion::before(2023-06-28)]
141+
fn early_error(msg: String) -> ! {
142+
rustc_session::early_error(
143+
rustc_session::config::ErrorOutputType::default(),
144+
Box::leak(msg.into_boxed_str()) as &str,
145+
)
146+
}
147+
148+
#[rustversion::since(2023-06-28)]
149+
extern crate rustc_errors;
150+
151+
#[rustversion::since(2023-06-28)]
152+
fn early_error(msg: impl Into<rustc_errors::DiagnosticMessage>) -> ! {
153+
let handler =
154+
rustc_session::EarlyErrorHandler::new(rustc_session::config::ErrorOutputType::default());
155+
handler.early_error(msg)
156+
}
157+
143158
#[rustversion::before(2022-07-14)]
144159
fn zero_mir_opt_level(config: &mut rustc_interface::Config) {
145160
trait Zeroable {

utils/linting/src/lib.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,7 @@ pub fn config_toml(name: &str) -> ConfigResult<Option<toml::Value>> {
456456
pub fn init_config(sess: &rustc_session::Session) {
457457
try_init_config(sess).unwrap_or_else(|err| {
458458
let msg = format!("could not read configuration file: {err}");
459-
rustc_session::early_error(
460-
rustc_session::config::ErrorOutputType::default(),
461-
Box::leak(msg.into_boxed_str()) as &str,
462-
);
459+
early_error(msg);
463460
});
464461
}
465462

@@ -565,3 +562,21 @@ fn local_crate_source_file(sess: &rustc_session::Session) -> Option<PathBuf> {
565562
fn local_crate_source_file(sess: &rustc_session::Session) -> Option<PathBuf> {
566563
sess.local_crate_source_file()
567564
}
565+
566+
#[rustversion::before(2023-06-28)]
567+
fn early_error(msg: String) -> ! {
568+
rustc_session::early_error(
569+
rustc_session::config::ErrorOutputType::default(),
570+
Box::leak(msg.into_boxed_str()) as &str,
571+
)
572+
}
573+
574+
#[rustversion::since(2023-06-28)]
575+
extern crate rustc_errors;
576+
577+
#[rustversion::since(2023-06-28)]
578+
fn early_error(msg: impl Into<rustc_errors::DiagnosticMessage>) -> ! {
579+
let handler =
580+
rustc_session::EarlyErrorHandler::new(rustc_session::config::ErrorOutputType::default());
581+
handler.early_error(msg)
582+
}

0 commit comments

Comments
 (0)