File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,19 @@ compile-time instead of run-time should not alter program behavior.
9797
9898### 4. Drop
9999
100- TODO: Fill this with information.
100+ Expressions containing types that implement ` Drop ` (or have a field implementing ` Drop ` )
101+ can never be promoted. If such an expression were promoted, the ` Drop ` impl would
102+ never get called on the value, even though the user did not explicitly request such
103+ behavior by using an explicit ` const ` or ` static ` item.
104+
105+ As expression promotion is essentially the silent insertion of a ` static ` item, and
106+ ` static ` items never have their ` Drop ` impl called, the ` Drop ` impl of the promoted
107+ value would never get called.
108+
109+ While it is sound to ` std::mem::forget ` any value and thus not call its ` Drop ` impl,
110+ it is unlikely to be the desired behavior in most cases and very likey to be confusing
111+ to the user. If such behavior is desired, the user can still use an explicit ` static `
112+ or ` const ` item and refer to that.
101113
102114## Open questions
103115
You can’t perform that action at this time.
0 commit comments