@@ -15,16 +15,16 @@ Some of the collection types do not allocate any memory when constructed empty (
15
15
is no longer required to be a hard error (as it is safe and accepted that these destructors may never run).
16
16
17
17
Allowing types with destructors to be directly used in ` const ` functions and stored in ` static ` s or ` const ` s will remove the need to have
18
- runtime-initialisation for global variables.
18
+ runtime-initialization for global variables.
19
19
20
20
# Detailed design
21
21
[ design ] : #detailed-design
22
22
23
23
- Lift the restriction on types with destructors being used in ` static ` or ` const ` items.
24
- - ` static ` s containing Drop-types will not run the destructor upon program/thread exit.
25
- - ` const ` s containing Drop-types _ will_ run the destructor at the appropriate point in the program.
26
- - (Optionally adding a lint that warn about the possibility of resource leak)
27
- - Alloc instantiating structures with destructors in constant expressions,
24
+ - ` static ` s containing Drop-types will not run the destructor upon program/thread exit.
25
+ - ` const ` s containing Drop-types _ will_ run the destructor at the appropriate point in the program.
26
+ - (Optionally adding a lint that warn about the possibility of resource leak)
27
+ - Allow instantiating structures with destructors in constant expressions.
28
28
- Allow ` const fn ` to return types with destructors.
29
29
- Disallow constant expressions that require destructors to run during compile-time constant evaluation (i.e: a ` drop(foo) ` in a ` const fn ` ).
30
30
@@ -62,11 +62,11 @@ A `const` item's destructor _will_ run at each point where the `const` item is u
62
62
# Alternatives
63
63
[ alternatives ] : #alternatives
64
64
65
- - Runtime initialisation of a raw pointer can be used instead (as the ` lazy_static ` crate currently does on stable)
65
+ - Runtime initialization of a raw pointer can be used instead (as the ` lazy_static ` crate currently does on stable).
66
66
- On nightly, a bug related to ` static ` and ` UnsafeCell<Option<T>> ` can be used to remove the dynamic allocation.
67
- - Both of these alternatives require runtime initialisation , and incur a checking overhead on subsequent accesses.
67
+ - Both of these alternatives require runtime initialization , and incur a checking overhead on subsequent accesses.
68
68
- Leaking of objects could be addressed by using C++-style ` .dtors ` support
69
- - This is undesirable, as it introduces confusion around destructor execution order.
69
+ - This is undesirable, as it introduces confusion around destructor execution order.
70
70
71
71
# Unresolved questions
72
72
[ unresolved ] : #unresolved-questions
0 commit comments