Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed May 31, 2023
1 parent 23a8541 commit 7270e4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cargo-dylint/tests/boundary_toolchains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
6 changes: 5 additions & 1 deletion driver/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(rustc_private)]
#![feature(string_leak)]
#![deny(clippy::expect_used)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::panic)]
Expand Down Expand Up @@ -119,14 +120,17 @@ 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<DiagnosticMessage>`.
// 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!(
"could not load library `{}`: {}",
path.to_string_lossy(),
err
)
.as_str(),
.leak() as &str,
);
});

Expand Down
3 changes: 2 additions & 1 deletion utils/linting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
//! [examples]: ../../examples
#![feature(rustc_private)]
#![feature(string_leak)]
#![warn(unused_extern_crates)]

#[allow(unused_extern_crates)]
Expand Down Expand Up @@ -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,
);
});
}
Expand Down

0 comments on commit 7270e4f

Please sign in to comment.