Unfortunately this doesn't appear to be formally documented anywhere that I can find, but I believe "drop glue" refers to the code the compiler generates to invoke the right drop()
calls in the right places. For example, if your struct S
contains a Vec<u32>
field but no explicit Drop
impl
, it will still have some "drop glue" for dropping the Vec<u32>
.
A common and subtle point of confusion is that a type having "drop glue" is not the same thing as a type implementing the Drop
trait. This is why T: Drop
bounds don't do what anyone expects them to do, and changes to make this less confusing have been discussed in the past. That sort of change is what I believe the end of @CAD97 's post is referring to.