HN Hall of Fame Weekly email

C2Rust: translate C into Rust code

Resurfaced independently across 2 calendar years, with breakout response in 2 of them.

submissions
4
submitters
4
observed span
2018–2022
peak thread · 87 comments
160 pts
latest 20+ return · 2022-02-01
140 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

This is compiling C into very unsafe Rust as a target language: pub unsafe extern "C" fn insertion_sort(n: libc::c_int, p: *mut libc::c_int) -> () { let mut i: libc::c_int = 1i32; while i < n { let tmp: libc::c_int = *p.offset(i as isize); let mut j: libc::c_int = i; while j > 0i32 && *p.offset((j - 1i32) as isize) > tmp { *p.offset(j as isize) = *p.offset((j - 1i32) as isize); j -= 1 } *p.offset(j as isize) = tmp…

Animats·160-point thread·

We kinda gave up on translating C into D, as many C constructs were unduly awkward to represent in D. What's working much better is to incorporate a C compiler directly into the D compiler. No need to translate, and the C semantics can be adhered to exactly. (The D compiler is extended to understand the C semantics coming from the C code, although that isn't part of the D specification.)

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
308

reference only — not used in Hall rules or ranking

Total comments
162

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2018-06-14C2rust translates most C modules into semantically equivalent Rust codectz60
2018-06-19C2Rust Demonstrationsphinxc0re20
2018-06-23C2Rust: translate C into Rust codeFirst breakout · Best threadblopeur16075
2022-02-01C2rust: Transpile C to RustLatest 20+ point returnjuancampa14087