Skip to content

Instantly share code, notes, and snippets.

@evilactually
Created July 18, 2025 07:09
Show Gist options
  • Save evilactually/4870e44238abe9f789a2305c3bbc95ac to your computer and use it in GitHub Desktop.
Save evilactually/4870e44238abe9f789a2305c3bbc95ac to your computer and use it in GitHub Desktop.
// ORIGINAL PROGRAM PRESENTED TO FUHRER
// ------------------------------------
struct A {
field: i32
}
impl A {
fn get_B(&self) -> B {
B {
a : self
}
}
}
struct B<'a> {
a:&'a A
}
struct C<'a> {
bs : Vec<&'a B<'a>>
}
impl C<'_> {
fn get_last_A(&self) -> &A {
self.bs.last().unwrap().a
}
}
fn F<'a>(a : &'a A) -> &'a A {
let b = a.get_B();
let c = C { bs : Vec::from([&b]) };
let last = c.get_last_A();
last
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment