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 dc49dc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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(),
);
});

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(),
);
});
}
Expand Down

0 comments on commit dc49dc1

Please sign in to comment.