Created
July 18, 2025 07:09
-
-
Save evilactually/4870e44238abe9f789a2305c3bbc95ac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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