Even if the function is declared as taking a pointer, references implicitly coerce, so it's rather moot what the decl uses IMO
-
This Tweet is unavailable.
-
-
Er, to clarify my tweet, my problem is not with using &, it's that the type being taken is fundamentally a pointer to a list of chars, not just one, and it would be nicer if a separate type existed for that, the way we have c_void
1 reply 0 retweets 2 likes -
Replying to @ManishEarth @sgrif and
would
@oli_obk's procedural vtable RFC address this?2 replies 0 retweets 0 likes -
it would if it allows for ZST DST fatness and also that DST pointers are repr(transparent) when the fatness is a ZST i'm not sure it does but iirc it does
1 reply 0 retweets 1 like -
Replying to @ManishEarth @sgrif and
I think it does allow that. here's the section on how it could be used for CStr https://github.com/oli-obk/rfcs/blob/procedural-vtables/text/0000-procedural-vtables.md#null-terminated-strings-stdfficstr …
2 replies 0 retweets 3 likes -
Replying to @yaahc_ @ManishEarth and
You'd still need the signature to take that type though instead of a raw pointer
2 replies 0 retweets 1 like -
yeah, this doesn't obviate the need for CString, but it obviates the need for CString in footgun-prone APIs you control
2 replies 0 retweets 2 likes -
Replying to @ManishEarth @yaahc_ and
For APIs you control is the key part here. I can already wrap things with a really small wrapper that takes &CStr. Removing the footgun for APIs you don't control is the important bit. If we're relying on all developers doing the thing that is more work we will be sad
1 reply 0 retweets 1 like -
well, no, you can control the rust bindings but maybe not the C header.
1 reply 0 retweets 1 like
I can't control every -sys crate out there
-
-
Manish Retweeted Manish
Manish added,
1 reply 0 retweets 1 like -
- 8 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.