Marin Veršić
Marin Veršić
damn, this is a good analysis of the issue. Indeed `&Cell` can be used since it's `repr(transparent)`. > extern "C" functions are always unsafe, if only because of the unchecked...
as for the "nullable pointer optimization" I wouldn't use for wrapping references for the same reasons I wouldn't use references. They provide guarantees to the compiler which may happen to...
> Option is equivalent to *const T / *mut T in all things, so that change is perfectly valid and leads to cleaner code, except for the lack of NonNullMut...
> impl From I agree with you that encoding the nullability is a big win, I was just "complaining" that it is a pity that Rust does not feature an...
@bjorn3 what you say is true, but I think you misunderstood the point. Please read the discussion.
@bjorn3 so it was me who misunderstood you :grin:. Sorry, about that. hm, indeed references will coerce into raw pointers without explicit conversion. I don't think coercion will cause any...
It's been a while since I've opened this issue. As I've come to learn, there is a trade off to using `NonNull`. Consider the following example: ```rust extern "C" {...
Let me emphasize this: **there is a difference whether you use `*const _` or `*mut _` pointer in FFI**. The difference is that mutating a value behind a `*const _`...
@bjorn3 I'll also link a recently started discussion on this: https://github.com/rust-lang/unsafe-code-guidelines/issues/257 on rust-lang. Would you still disagree?
Wouldn't this be considered UB as well? main.c ```c void foo(*int ptr) { // due to some bug C code modifies the given pointer (int)*ptr = 10; } ``` main.rs...