My LLM thinks it has found a bug. Demonstrated by this code which triggers UB under Miri:
use std::mem::MaybeUninit;
use triomphe::{ArcBorrow, UniqueArc};
fn main() {
let mut unique = UniqueArc::<u8>::new_uninit();
let borrow = unsafe { ArcBorrow::from_ptr(unique.as_mut_ptr()) };
let arc = borrow.clone_arc();
let shared = &*arc;
*unique = MaybeUninit::new(0);
std::hint::black_box(shared);
}
To me it seems a bit bullshit because it's clearly violating the intent of UniqueArc by using unsafe to create multiple pointers to its allocation. The LLM claims that technically there's nothing in the (textual) contract of ArcBorrow::from_ptr to prevent this.
Feel free to close if this is not useful.
My LLM thinks it has found a bug. Demonstrated by this code which triggers UB under Miri:
To me it seems a bit bullshit because it's clearly violating the intent of
UniqueArcby usingunsafeto create multiple pointers to its allocation. The LLM claims that technically there's nothing in the (textual) contract ofArcBorrow::from_ptrto prevent this.Feel free to close if this is not useful.