I misunderstood the reason the error was showing up. It seems like using a closure fixes it though.
#[macro_export]
macro_rules! list {
() => {
None
};
[ $x:expr, $( $y:expr ),* ] => {{
#[allow(unused_assignments)]
let closure = move || {
let mut first = cons($x, &None);
let mut last = &mut first;
$(
let yet_another = cons($y, &None);
if let Some(ref mut last_inner) = last {
let last_mut = Rc::get_mut(last_inner).unwrap();
last_mut.cdr = yet_another;
last = &mut last_mut.cdr;
}
)*
first
};
closure()
}}
}