Open spernsteiner opened 2 months ago
We can now analyze, rewrite, compile, and run simple_buffer
after patching it with workarounds for various c2rust-analyze
issues. As we fix the issues tracked here, we can remove the workarounds until simple_buffer
works unmodified.
I've implemented fully interprocedural pointee type analysis (on a dev branch - no PR yet), and it now produces correct pointee types for the data
field and for all malloc
/free
/realloc
calls. Next I'm planning to look at the borrowck Rvalue::Cast
issue.
simple_buffer
is a simplified buffer implementation (similar toVec<u8>
) designed to mimic lighttpd'sbuffer
module.Rvalue::Cast
output. This is triggered bymalloc(...) as *mut buffer
.buffer
has one origin param for its internal data pointer, but theborrowck::LTy
computed for the cast has no origin params.Rvalue::Ref
arising fromlet ref mut fresh = ...;
.return malloc(...)
removesUNIQUE
from the output pointer because Polonius reports an error.UNIQUE
due to overlapping borrows aroundrealloc
:UNIQUE
due to two-phase-like behavior inbuffer_realloc(buf, (*buf).cap * 2)
.malloc
/realloc
calls not being recognized as rewritable viaSafeMalloc
/SafeRealloc
.derive(Copy)
is left onstruct buffer
even after rewriting thedata
pointer to useBox
.Option
(NULL
) andResult
(DynOwned
/FREE
) rewrites.data
due to lack of interprocedural inference variable handling. The pointee analysis creates an inference variable for eachmalloc
call; currently, this must be unified with a concrete type (e.g.u8
) within the current function, or else the result will be markedincomplete
.