Closed
Description
This is just some experimentation on my part that triggered an ICE. I may have time to investigate later but for now here is the smallest chunk of code I have and a playground session.
use std::thunk::Thunk;
use std::cell::UnsafeCell;
use std::mem::transmute;
struct Lazy<T> {
value: UnsafeCell<Option<T>>,
thunk: UnsafeCell<Option<Thunk<(), T>>>,
}
impl<T> Lazy<T> {
fn value(&self) -> &T {
unsafe {
let value = self.value.get();
// deleted some code here
let raw_value = &(*value).unwrap();
transmute(raw_value)
}
}
}
fn main() {
}