that microsoft rust rewrite post got me thinking about my own c to rust attempt

149 points Legal_Airport6155 56 comments

saw that microsoft post about rewriting c/c++ to rust with ai. reminded me i tried this last year

had a personal c project, around 12k lines. packet analyzer i wrote years ago. wanted to learn rust so figured id port it

tried using ai tools to speed it up. normally use verdent cause i can switch between claude and gpt for different tasks, used claude for the tricky ownership stuff and gpt for basic conversions

basic syntax stuff worked fine. loops and match expressions converted ok

pointers were a disaster tho. ai kept suggesting clone() everywhere or just slapping references on things. had to rethink the whole ownership model

i had this memory pool pattern in c that worked great. ai tried converting it literally. complete nonsense in rust. ended up just using vec and letting rust handle it

took way longer than expected. got maybe half done before i gave up and started over with a cleaner design

the "it compiles" thing bit me hard. borrow checker was happy but runtime behavior was wrong. spent days debugging that

microsofts 1 million lines per month claim seems crazy. maybe for trivial code but real systems have so much implicit knowledge baked in

ai is useful for boilerplate but the hard parts you gotta understand yourself