Created
January 25, 2022 08:28
-
-
Save nanpuyue/df0b0c0386b8934d30af1b3d5b03b4a0 to your computer and use it in GitHub Desktop.
This file contains 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
struct S<'a> { | |
a: &'a (), | |
} | |
impl<'a> S<'a> { | |
fn feed(&self, data: &'a [u8]) { | |
drop(data); | |
} | |
fn get_a(&self) -> &() { | |
self.a | |
} | |
} | |
fn main() { | |
let a = &(); | |
let s = S { a }; | |
let data = vec![b'x', b'x']; | |
s.feed(&data); | |
drop(data); | |
dbg!(s.get_a()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment