From 3ad45d8fb1df398d95e4de730e5bfe05e522a3f4 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Wed, 29 Apr 2026 16:44:29 +0200 Subject: [PATCH] feat: make `as_os_strs` easier to use Make trailing comma optional. Return array, rather than reference to array, to eliminate lifetime issues. Closes #12688 --- crates/build-helper/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/build-helper/src/lib.rs b/crates/build-helper/src/lib.rs index 5b84b6623..a416bb591 100644 --- a/crates/build-helper/src/lib.rs +++ b/crates/build-helper/src/lib.rs @@ -98,14 +98,14 @@ pub fn target_os_is_cygwin() -> bool { #[macro_export] macro_rules! as_os_strs { - [ $( $x:expr, )* ] => { + [ $( $x:expr ),* $(,)? ] => { { use std::ffi::OsStr; fn as_os_str + ?Sized>(s: &S) -> &OsStr { s.as_ref() } - &[ - $( as_os_str($x), )* + [ + $( as_os_str($x) ),* ] } }