C2Rust: translate C into Rust code
This is compiling C into very unsafe Rust as a target language:<p><pre><code>    pub unsafe extern &quot;C&quot; fn insertion_sort(n: libc::c_int, p: *mut libc::c_int)
 -&gt; () {
        let mut i: libc::c_int = 1i32;
        while i &lt; n {
            let tmp: libc::c_int = *p.offset(i as isize);
            let mut j: libc::c_int = i;
            while j &gt; 0i32 &amp;&amp; *p.offset((j - 1i32) as isize) &gt; 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&#x27;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&#x27;t even comprehend arrays in C.<p>A good translator might need some human help to deal with C&#x27;s ambiguities.  Like &quot;Is this an array? (Y or N)&quot;  How big is it?  (Enter expression). Then you get a program that&#x27;s real Rust.  If the user is wrong about the size, safe Rust will either allocate too much space or get a subscript error.