From 4cc97303072009efe5da7fa2bc707f8058b3c53d Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 17 Oct 2024 11:21:43 -0500 Subject: [PATCH] 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: 279f38918f03 ("nak: memstream: move into common code") Part-of: --- src/compiler/rust/memstream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/rust/memstream.rs b/src/compiler/rust/memstream.rs index 3d7bdcda01c..00adaa71517 100644 --- a/src/compiler/rust/memstream.rs +++ b/src/compiler/rust/memstream.rs @@ -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());