Last active
March 3, 2025 07:13
-
-
Save ArtemGr/ca4bc0433ea3387992f1fa80ac40e6fd to your computer and use it in GitHub Desktop.
maybe0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(maybe_uninit_as_bytes)] // https://github.com/rust-lang/rust/issues/93092 | |
#![feature(maybe_uninit_slice)] | |
use std::hint::black_box; | |
use std::mem::MaybeUninit; | |
#[unsafe(no_mangle)] pub extern "C" fn maybe0() -> bool { | |
let str: MaybeUninit<String> = MaybeUninit::zeroed(); | |
unsafe {str.as_bytes().assume_init_ref()} .iter().all (|&b| b == 0)} | |
#[unsafe(no_mangle)] pub extern "C" fn maybe0black() -> bool { | |
let str: MaybeUninit<String> = MaybeUninit::zeroed(); | |
unsafe {black_box (str.as_bytes().assume_init_ref())} .iter().all (|&b| b == 0)} | |
fn main() {let _ = maybe0black();} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment