diff --git a/cargo-dylint/tests/boundary_toolchains.rs b/cargo-dylint/tests/boundary_toolchains.rs index 574b1983e..efc66ab44 100644 --- a/cargo-dylint/tests/boundary_toolchains.rs +++ b/cargo-dylint/tests/boundary_toolchains.rs @@ -8,7 +8,10 @@ use test_log::test; // smoelius: The channel date is one day later than the `rustc --version` date. // smoelius: Put recent boundaries first, since they're more likely to cause problems. // smoelius: The relevant PRs and merge commits appear before each boundary. -const BOUNDARIES: [(&str, &str); 4] = [ +const BOUNDARIES: [(&str, &str); 5] = [ + // https://github.com/rust-lang/rust/pull/111748 + // https://github.com/rust-lang/rust/commit/70e04bd88d85cab8ed110ace5a278fab106d0ef5 + ("2023-05-29", "2023-05-30"), // https://github.com/rust-lang/rust/pull/111633 // https://github.com/rust-lang/rust/commit/08efb9d652c840715d15954592426e2befe13b36 ("2023-05-18", "2023-05-19"), diff --git a/driver/src/lib.rs b/driver/src/lib.rs index 816e76cb4..06f548041 100644 --- a/driver/src/lib.rs +++ b/driver/src/lib.rs @@ -1,4 +1,5 @@ #![feature(rustc_private)] +#![feature(string_leak)] #![deny(clippy::expect_used)] #![deny(clippy::unwrap_used)] #![deny(clippy::panic)] @@ -119,6 +120,9 @@ impl Callbacks { let lib = result.unwrap_or_else(|err| { // smoelius: rust-lang/rust#111633 changed the type of `early_error`'s `msg` // argument from `&str` to `impl Into`. + // smoelius: And rust-lang/rust#111748 made it that `msg` is borrowed for + // `'static`. Since the program is about to exit, it's probably fine to leak the + // string. rustc_session::early_error( rustc_session::config::ErrorOutputType::default(), format!( @@ -126,7 +130,7 @@ impl Callbacks { path.to_string_lossy(), err ) - .as_str(), + .leak() as &str, ); }); diff --git a/utils/linting/src/lib.rs b/utils/linting/src/lib.rs index 706281273..d4968d2ca 100644 --- a/utils/linting/src/lib.rs +++ b/utils/linting/src/lib.rs @@ -168,6 +168,7 @@ //! [examples]: ../../examples #![feature(rustc_private)] +#![feature(string_leak)] #![warn(unused_extern_crates)] #[allow(unused_extern_crates)] @@ -457,7 +458,7 @@ pub fn init_config(sess: &rustc_session::Session) { try_init_config(sess).unwrap_or_else(|err| { rustc_session::early_error( rustc_session::config::ErrorOutputType::default(), - format!("could not read configuration file: {err}").as_str(), + format!("could not read configuration file: {err}").leak() as &str, ); }); }