You can put lipstick on a pig
lipstick
compiles a subset of Rust's syntax into C. It's not a "Rust subset" though, since there's not borrow checker or lifetimes. It's simply a Rust-like syntax frontend for C.
Because it's fun, duh.
Also, it might be a good teaching tool, so you can temporarily "turn off" the borrow checker. You can see how writing in unsafe system languages looks like, without actually having any C or C++ knowledge.
rust
fn foo() -> &u32 {
let x: u32 = 7;
let y: &u32 = &x;
return y;
}
```c
u32* foo() { u32 x = 7; u32 *y = &x; return y; } ```
impl
s, visibility modifiers, paths, tuples, patterns, attributes, etc.match
→ switch
while
, loop
, for i in 0..n {}
, if-else
.u32
, i32
, usize
, ...&x
and *x
.restrict
, const
or volatile
shenanigans.todo!()
s and panics.->
operator.use
modulesstatic
svolatile
)