3 ms·
2664 "unsafe {", 1835 "unsafe fn". This is completely unsafe. It doesn't look like a rewrite that understands what's actually going on or how the architecture s
by cyber1 3mo ago
2664 "unsafe {", 1835 "unsafe fn". This is completely unsafe. It doesn't look like a rewrite that understands what's actually going on or how the architecture should be redesigned to take advantage of Rust strengths. Instead, it looks like an AI generated transpilation with extensive use of raw pointers.
- malisper 3mo agoNote that most of the unsafes are confined to the parser which was generated by running c2rust over the Postgres parser. The Postgres parser is itself generated from yacc/bison, so I decided to port it over mechanically rather than idiomatically. If there's particular unsafes that you think are egregious, let me know.
- saym 3mo agoJust wanted to say: I'm thoroughly impressed with how far in the weeds you're replying in this comment section. I'm learning a lot from the threads.
- dvhh 3mo agoI don't know if converting the code could be an issue with copyright, but might be contrived as plagiarism
- Stalecelin 3mo agooh no.. will they get grounded?
- kaspar030 3mo agoI set all my Rust LLM written projects to 'unsafe=deny'. Not sure why not everyone is anticipating your comment.
- HeavyStorm 3mo agoWhy even use rust...
- maximilianburke 3mo agoBecause in C everything is unsafe, by definition.
- hexo 3mo agowhat a nonsense
- maximilianburke 3mo agoCare to explain?
- robotic 3mo agoLet me just copy this review comment into my prompt. a few hours later Fixed!
- atombender 3mo agoCounterpoint: All of the current Postgres codebase is already wrapped in an invisible unsafe{}. The difference with a Rust codebase like this is that all of the unsafe code has been neatly isolated and clearly marked. The outside code is safe — at least according to the definition of what Rust considers safe, which is a high bar indeed and objectively superior to the unsafe mess that is C — and the unsafe code is naturally fenced in, which means that it can be seen by developers and tackled by incrementally. In some cases unsafe is unavoidable, but it is possible for a human to verify that it is, in fact, acceptably safe even if inside an unsafe block.
- cyber1 3mo agoValid point, but unsafe in Rust is more dangerous than unsafe in C, bcs of aliasing. For example PG is compiled with -fno-strict-aliasing.
- selfmodruntime 3mo agoThank you. I write quite a lot of unsafe code myself and while safe Rust is much easier to get right than C, I'd say unsafe Rust is at least 10x harder to do correctly. Rustc's aliasing rules don't vanish when you use unsafe, you'll have to uphold them yourself!