Skip to content

Commit e91518e

Browse files
committed
Fix botched fix for rust-lang/rust#111633
1 parent 23a8541 commit e91518e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

driver/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ impl Callbacks {
119119
let lib = result.unwrap_or_else(|err| {
120120
// smoelius: rust-lang/rust#111633 changed the type of `early_error`'s `msg`
121121
// argument from `&str` to `impl Into<DiagnosticMessage>`.
122+
let msg = format!(
123+
"could not load library `{}`: {}",
124+
path.to_string_lossy(),
125+
err
126+
);
122127
rustc_session::early_error(
123128
rustc_session::config::ErrorOutputType::default(),
124-
format!(
125-
"could not load library `{}`: {}",
126-
path.to_string_lossy(),
127-
err
128-
)
129-
.as_str(),
129+
msg.as_str(),
130130
);
131131
});
132132

utils/linting/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,10 @@ pub fn config_toml(name: &str) -> ConfigResult<Option<toml::Value>> {
455455
/// etc. includes a call to `init_config`.
456456
pub fn init_config(sess: &rustc_session::Session) {
457457
try_init_config(sess).unwrap_or_else(|err| {
458+
let msg = format!("could not read configuration file: {err}");
458459
rustc_session::early_error(
459460
rustc_session::config::ErrorOutputType::default(),
460-
format!("could not read configuration file: {err}").as_str(),
461+
msg.as_str(),
461462
);
462463
});
463464
}

0 commit comments

Comments
 (0)