pub enum ForInit {
None,
Expr(Expr),
Decl(Box<Decl>),
StaticAssert(StaticAssert),
}Expand description
The init clause of a for statement.
Variants§
None
for (; …)
Expr(Expr)
for (expr; …)
Decl(Box<Decl>)
for (int i = 0; …) — C99.
StaticAssert(StaticAssert)
for (_Static_assert(1, "…"); …).
A static assertion is a declaration, so the grammar puts it here,
and C11 6.8.5p3 then forbids it — the clause may only declare objects
with automatic or register storage duration, and this declares nothing
at all. GCC and Clang both accept it anyway (Clang’s C11/n1330.c
says so in as many words), it asserts exactly what it would one line
higher up, and refusing it would be refusing something both compilers
this crate follows take.
Trait Implementations§
impl StructuralPartialEq for ForInit
Auto Trait Implementations§
impl Freeze for ForInit
impl RefUnwindSafe for ForInit
impl Send for ForInit
impl Sync for ForInit
impl Unpin for ForInit
impl UnsafeUnpin for ForInit
impl UnwindSafe for ForInit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more