Skip to content

Commit 72d3f9c

Browse files
taiki-ecramertj
authored andcommitted
Support trailing commas in pin_mut! macro
1 parent 697a723 commit 72d3f9c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/stack_pin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// ```
1111
#[macro_export]
1212
macro_rules! pin_mut {
13-
($($x:ident),*) => { $(
13+
($($x:ident),* $(,)?) => { $(
1414
// Move the value to ensure that it is owned
1515
let mut $x = $x;
1616
// Shadow the original binding so that it can't be directly accessed

tests/stack_pin.rs

+9
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,13 @@ fn stack_pin() {
99
let foo = Foo {};
1010
pin_mut!(foo);
1111
let _: Pin<&mut Foo> = foo;
12+
13+
let bar = Foo {};
14+
let baz = Foo {};
15+
pin_mut!(
16+
bar,
17+
baz,
18+
);
19+
let _: Pin<&mut Foo> = bar;
20+
let _: Pin<&mut Foo> = baz;
1221
}

0 commit comments

Comments
 (0)