Drop order @rustlang poll
{
let a = PrintOnDrop("a");
a;
print!("b");
}
print!(" ");
{
let c = PrintOnDrop("c");
let _ = c;
print!("d");
}
No checking before answering the poll! This will print:
-
-
Specifically, if a type has drop glue (impls Drop or recursively contains a type that impls Drop), then said drop glue is invoked at the end of scope, and that counts as a use for NLL. NLL only impacts shortening of lifetimes for types which are trivially droppable.
-
So apparently there are special rules around some types which are not Drop but contain a Drop type (all public fields?) to make impl Drop less breaking and I give up it's impossible for a human to know all of the drop timing without help from rustc https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fb84cddc57a60d73ad06d2447b89613d …
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.