We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14b767d commit ca909c8Copy full SHA for ca909c8
src/libcore/ops.rs
@@ -199,6 +199,18 @@ use marker::Unsize;
199
/// let _x = Outer(Inner);
200
/// }
201
/// ```
202
+///
203
+/// Because variables are dropped in the reverse order they are declared,
204
+/// `main` will print `Declared second!` and then `Declared first!`.
205
206
+/// ```
207
+/// struct PrintOnDrop(&'static str);
208
209
+/// fn main() {
210
+/// let _first = PrintOnDrop("Declared first!");
211
+/// let _second = PrintOnDrop("Declared second!");
212
+/// }
213
214
#[lang = "drop"]
215
#[stable(feature = "rust1", since = "1.0.0")]
216
pub trait Drop {
0 commit comments