compiler/rust: Fix a bad cast in the memstream abstraction

If you just do ref.cast(), it will cast the thing it's a reference to.
If you want to turn a reference into a pointer, you need to explicitly
use "as".

Fixes: 279f38918f ("nak: memstream: move into common code")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31718>
This commit is contained in:
Faith Ekstrand
2024-10-17 11:21:43 -05:00
committed by Marge Bot
parent 212e07a70e
commit 4cc9730307

View File

@@ -33,7 +33,7 @@ impl MemStream {
let stream_impl = stream_impl.as_mut().get_unchecked_mut();
if !bindings::u_memstream_open(
&mut stream_impl.stream,
(&mut stream_impl.buffer).cast(),
(&mut stream_impl.buffer as *mut *mut u8).cast(),
&mut stream_impl.buffer_size,
) {
return Err(io::Error::last_os_error());