C2Rust: translate C into Rust code
This is compiling C into very unsafe Rust as a target language:<p><pre><code>    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;
            i += 1
        };
    }
</code></pre>
The output is unmaintainable, like the output from a compiler. This isn't translation into usable Rust.<p>A C++ to Rust translator would be a good thing, but it has to be much smarter than this.  This doesn't even comprehend arrays in C.<p>A good translator might need some human help to deal with C's ambiguities.  Like "Is this an array? (Y or N)"  How big is it?  (Enter expression). Then you get a program that's real Rust.  If the user is wrong about the size, safe Rust will either allocate too much space or get a subscript error.