Subject: Re: [PATCH v3 06/15] ivec: create a vector type that is interoperable between C and Rust

From: "Kristoffer Haugsbakk" <[email-masked]>
Date: Sat, 23 Aug 2025 10:12:59 +0200

On Sat, Aug 23, 2025, at 05:55, Ezekiel Newren via GitGitGadget wrote:
> From: Ezekiel Newren <[email-masked]>
>
> Trying to use Rust's Vec in C, or git's ALLOC_GROW() macros (via
> wrapper functions) in Rust is painful because:

nit: s/git's/Git's/

> [snip]
> diff --git a/rust/interop/src/ivec.rs b/rust/interop/src/ivec.rs
> [snip]
> +        // assert_eq!(vec.capacity, vec.slice.len());

Why are there three commented-out assertions? (all capacity/length)

> +        assert_eq!(expected, vec.length);
> +        assert!(vec.capacity >= expected);
> +        for i in 0..vec.length {
> +            assert_eq!(default_value, vec[i]);
> +        }
> [snip]

-- 
Kristoffer Haugsbakk