Skip to content

Commit 90d1885

Browse files
committed
Fix missing unsafe block for the nightly change
Fix #10022
1 parent 793389b commit 90d1885

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/hir_expand/src/builtin_macro.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,13 @@ fn format_args_expand(
256256
quote! { std::fmt::ArgumentV1::new(&(#arg), std::fmt::Display::fmt), }
257257
}.token_trees);
258258
let expanded = quote! {
259-
std::fmt::Arguments::new_v1(&[], &[##arg_tts])
259+
// It's unsafe since https://github.com/rust-lang/rust/pull/83302
260+
// Wrap an unsafe block to avoid false-positive `missing-unsafe` lint.
261+
// FIXME: Currently we don't have `unused_unsafe` lint so an extra unsafe block won't cause issues on early
262+
// stable rust-src.
263+
unsafe {
264+
std::fmt::Arguments::new_v1(&[], &[##arg_tts])
265+
}
260266
};
261267
ExpandResult::ok(expanded)
262268
}

0 commit comments

Comments
 (0)