Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Jun 1, 2023
1 parent 23a8541 commit 77095e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 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
15 changes: 9 additions & 6 deletions driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,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.
let msg = format!(
"could not load library `{}`: {}",
path.to_string_lossy(),
err
);
rustc_session::early_error(
rustc_session::config::ErrorOutputType::default(),
format!(
"could not load library `{}`: {}",
path.to_string_lossy(),
err
)
.as_str(),
Box::leak(msg.into_boxed_str()) 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 @@ -455,9 +455,10 @@ pub fn config_toml(name: &str) -> ConfigResult<Option<toml::Value>> {
/// etc. includes a call to `init_config`.
pub fn init_config(sess: &rustc_session::Session) {
try_init_config(sess).unwrap_or_else(|err| {
let msg = format!("could not read configuration file: {err}");
rustc_session::early_error(
rustc_session::config::ErrorOutputType::default(),
format!("could not read configuration file: {err}").as_str(),
Box::leak(msg.into_boxed_str()) as &str,
);
});
}
Expand Down

0 comments on commit 77095e6

Please sign in to comment.