Closed as-com closed 6 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 51.71%. Comparing base (
ab342b3
) to head (2861b2c
). Report is 4 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks!
I moved the empty list case outside of the unsafe
block: https://github.com/capnproto/capnproto-rust/commit/edac9159fbd7006378b74f06188d3d3ac591da78
At least on my machine, calling
.as_slice()
on an empty primitive list with elements u16 or larger in Rust nightly in debug mode results in a panic like this:This is because
ListReader::into_raw_bytes
andListBuilder::as_raw_bytes
return an empty&[u8]
when the list is empty, which has a pointer value of 1 in this version of Rust.The documentation for
std::slice::from_raw_parts
notes:This PR adds a check to avoid creating an invalid empty slice and and adds some test cases for empty primitive lists of larger types.