#RustQuiz

A. X gives compilation error & Y prints "Kernel" then "Dropped"

B. X prints "Kernel" & Y gives compilation error

C. X prints "Kernel" & Y prints "Kernel" then "Dropped"

D. Both X & Y gives compilation error

#rustlang #rust

@AstraKernel

I'll just leave this link for people to read - https://doc.rust-lang.org/reference/destructors.html

Destructors - The Rust Reference

@AstraKernel I gonna try D this time.

I can imagine this failing to compile because the inferred type of r involves the lifetime of s, but r is defined (without being initialized) before that lifetime begins

Which means the drop impl is a shiny red herring; if so, nicely done :)