Note on why refcount tests need result type

This commit is contained in:
Brian Carroll 2021-12-31 23:52:05 +00:00
parent 12a330dd76
commit ff0c0766ad

View file

@ -417,8 +417,10 @@ pub fn identity<T>(value: T) -> T {
#[allow(unused_macros)]
macro_rules! assert_refcounts {
// We need the result type to generate the test_wrapper, even though we ignore the value!
// We can't just call `main` with no args, because some tests return structs, via pointer arg!
// Also we need to know how much stack space to reserve for the struct.
($src: expr, $ty: ty, $expected_refcounts: expr) => {
// Same as above, except with an additional transformation argument.
{
let phantom = std::marker::PhantomData;
let num_refcounts = $expected_refcounts.len();