-
Notifications
You must be signed in to change notification settings - Fork 34
Update the derive crate #100
base: master
Are you sure you want to change the base?
Conversation
When trying to run the tests on my machine I encountered some funny behaviour with #[test]
fn sanity_check_heapsize_works_as_expected() {
assert_eq!(Box::new(1_u8).heap_size_of_children(), mem::size_of::<u8>());
assert_eq!([Box::new(1), Box::new(2)].heap_size_of_children(), 2 * 4);
} |
What is the test failure message? |
This is what I'm seeing when running the tests: ---- sanity_check_heapsize_works_as_expected stdout ----
thread 'sanity_check_heapsize_works_as_expected' panicked at 'assertion failed: `(left == right)`
left: `8`,
right: `1`', test.rs:21:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
---- tuple_struct stdout ----
thread 'tuple_struct' panicked at 'assertion failed: `(left == right)`
left: `24`,
right: `9`', test.rs:13:5
---- normal_struct stdout ----
thread 'normal_struct' panicked at 'assertion failed: `(left == right)`
left: `32`,
right: `17`', test.rs:43:5 @jdm It looks like |
@jdm I made appveyor test the Perhaps this is something particular to whatever allocator is being used on my machine? Apparently the amount of heap memory used by a #[test]
fn sanity_check_heapsize_works_as_expected() {
let array = [1.0_f64; 10];
let boxed = Box::new(array);
assert_eq!(boxed.heap_size_of_children(), mem::size_of_val(&array));
}
|
It looks like the CI failure is because the top-level |
I just encountered an issue where the
heapSizeOf
derive wasn't able to parsedyn Trait
in a struct, so I thought I'd make a PR to updateheapsize_derive
to use the latest versions ofsyn
andquote
... Unfortunately almost all ofsyn
's API has changed since the custom derive was originally written, so the simplecargo update
turned into a rewrite 😞We'll probably want to test this PR against a large-ish codebase that already uses
heapsize
to make sure I didn't accidentally introduce any regressions.This change is