If I want to write destructors for all of these I need a macro, right?
-
-
Replying to @porglezomp
yeah you can’t pass drop/dtor types by value the abi doesn’t work
1 reply 0 retweets 0 likes -
-
Replying to @porglezomp
// My solution: #[repr(C)] pub struct RawVec<T> { len: usize, ptr: *mut T, } macro_rules! free_vec { ($($name:ident :
$T:ty,)+) => {$( #[no_mangle] pub extern "C" fn$name(vec:$T) { drop(vec.into_vec()) } )*} }1 reply 0 retweets 0 likes -
Replying to @porglezomp
And then manually do like free_vec! { cs_free_comics: RawVec<ComicId>, } for every type I care about
1 reply 0 retweets 0 likes -
Replying to @porglezomp
yeah that's basically what you need to do but doing it with macros is a pain in the ass since you need to use the unstable rustc expland flags for cbindgen to be able to see the code
2 replies 0 retweets 0 likes -
Replying to @Gankra_
Ah yeah, if I switch to stable from nightly it seems to have a bit of trouble.
1 reply 0 retweets 0 likes -
Replying to @porglezomp
Also turning on expand makes it get grumpy about the diesel items in the crate, so maybe I should just do it by hand. My API changes made it nice enough that it's just a few lines to copy-paste.
2 replies 0 retweets 1 like -
Replying to @porglezomp
Curious about what the error was. We should try to fix that
1 reply 0 retweets 0 likes -
Replying to @sgrif
No errors, just lots and lots of warnings like: WARN: Skip comics::_impl_queryable_for_comic - (not `pub`). WARN: Skip comics::_impl_queryable_for_chapter - (not `pub`). WARN: Skip comics::_impl_queryable_for_page - (not `pub`).
1 reply 0 retweets 0 likes
Ah ok. That's what I'd expect. We should be able to get rid of that once we drop support for the 2015 edition (that is a hack to let us use our derives within Diesel, so we can't just assume `extern crate diesel` works)
-
-
Replying to @sgrif @porglezomp
Right now our workaround is to do, `mod diesel { __diesel_use_everything!(); }`, and then `self::diesel` everywhere... The macro is just `use
$crate::*`. It's been interesting to see this hack evolve over time.1 reply 0 retweets 0 likes -
Replying to @sgrif @porglezomp
Originally this was all to support `use diesel as foo`, but now that happens at the cargo level and there's literally no way to support it so we just don't care about that use case anymore (tbh it was a weak use case to begin with)
1 reply 0 retweets 0 likes - 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.