Closed
Description
Here’s a repro, in small steps with useful type annotations
use yoke::Yoke;
type F<'a> = fn(&'a ());
fn main() {
let n = String::from("Hello World!");
let x: Yoke<&'static str, Box<F<'_>>> = Yoke::attach_to_cart(Box::new((|_| {}) as _), |_| &n[..]);
let y: Yoke<&'static str, Box<F<'static>>> = x;
let s: &'static Yoke<&'static str, Box<F<'static>>> = Box::leak(Box::new(y));
let r: &'static str = s.get();
println!("pre-drop: {r}");
drop(n);
println!("post-drop: {r}");
}
pre-drop: Hello World!
post-drop: �[YU��Es