Skip to content

Commit 7270e4f

Browse files
committed
1 parent 23a8541 commit 7270e4f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

cargo-dylint/tests/boundary_toolchains.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use test_log::test;
88
// smoelius: The channel date is one day later than the `rustc --version` date.
99
// smoelius: Put recent boundaries first, since they're more likely to cause problems.
1010
// smoelius: The relevant PRs and merge commits appear before each boundary.
11-
const BOUNDARIES: [(&str, &str); 4] = [
11+
const BOUNDARIES: [(&str, &str); 5] = [
12+
// https://github.com/rust-lang/rust/pull/111748
13+
// https://github.com/rust-lang/rust/commit/70e04bd88d85cab8ed110ace5a278fab106d0ef5
14+
("2023-05-29", "2023-05-30"),
1215
// https://github.com/rust-lang/rust/pull/111633
1316
// https://github.com/rust-lang/rust/commit/08efb9d652c840715d15954592426e2befe13b36
1417
("2023-05-18", "2023-05-19"),

driver/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(rustc_private)]
2+
#![feature(string_leak)]
23
#![deny(clippy::expect_used)]
34
#![deny(clippy::unwrap_used)]
45
#![deny(clippy::panic)]
@@ -119,14 +120,17 @@ impl Callbacks {
119120
let lib = result.unwrap_or_else(|err| {
120121
// smoelius: rust-lang/rust#111633 changed the type of `early_error`'s `msg`
121122
// argument from `&str` to `impl Into<DiagnosticMessage>`.
123+
// smoelius: And rust-lang/rust#111748 made it that `msg` is borrowed for
124+
// `'static`. Since the program is about to exit, it's probably fine to leak the
125+
// string.
122126
rustc_session::early_error(
123127
rustc_session::config::ErrorOutputType::default(),
124128
format!(
125129
"could not load library `{}`: {}",
126130
path.to_string_lossy(),
127131
err
128132
)
129-
.as_str(),
133+
.leak() as &str,
130134
);
131135
});
132136

utils/linting/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
//! [examples]: ../../examples
169169
170170
#![feature(rustc_private)]
171+
#![feature(string_leak)]
171172
#![warn(unused_extern_crates)]
172173

173174
#[allow(unused_extern_crates)]
@@ -457,7 +458,7 @@ pub fn init_config(sess: &rustc_session::Session) {
457458
try_init_config(sess).unwrap_or_else(|err| {
458459
rustc_session::early_error(
459460
rustc_session::config::ErrorOutputType::default(),
460-
format!("could not read configuration file: {err}").as_str(),
461+
format!("could not read configuration file: {err}").leak() as &str,
461462
);
462463
});
463464
}

0 commit comments

Comments
 (0)