Comments 5
Очень интересно (но не настолько чтобы рыться в обсуждениях) насчёт static
/cost
Drop
: как оно работать будет?
+3
Если коротко из RFC:
Allow types with destructors to be used in static items and in const functions, as long as the destructor never needs to run in const context.
Allow types with destructors to be used in static items and in const functions, as long as the destructor never needs to run in const context.
- Lift the restriction on types with destructors being used in statics.
- statics containing Drop-types will not run the destructor upon program/thread exit.
- (Optionally adding a lint that warn about the possibility of resource leak)
- Alloc instantiating structures with destructors in constant expressions,
- Continue to prevent const items from holding types with destructors.
- Allow const fn to return types with destructors.
- Disallow constant expressions which would result in the destructor being called (if the code were run at runtime).
+3
В общем, lazy_static пора на покой наконец.
0
Спасибо, стало понятнее. Собственно, понятно всё, кроме последнего пункта:
Disallow constant expressions which would result in the destructor being called (if the code were run at runtime).
Может есть пример?
+1
Only those users with full accounts are able to leave comments. Log in, please.
Выпуск Rust 1.22 (и 1.22.1)