@@ -51,6 +51,9 @@ earlier version of miri used to panic on arithmetic overflow even in release
51
51
mode. This breaks promotion, because now promoting code that would work (and
52
52
could not panic!) at run-time leads to a compile-time CTFE error.
53
53
54
+ * Dynamic check.* The Miri engine already dynamically detects panics, but the
55
+ main point of promoteds is ruling them out statically.
56
+
54
57
### 2. Const safety
55
58
56
59
We have explained what happens when evaluating a promoted panics, but what about
@@ -94,6 +97,9 @@ but to abort compilation of a program that would have compiled fine if we would
94
97
not have decided to promote. It is the responsibility of ` foo ` to not fail this
95
98
way when working with const-safe arguments.
96
99
100
+ * Dynamic check.* The Miri engine already dynamically detects const safety
101
+ violations, but the main point of promoteds is ruling them out statically.
102
+
97
103
### 3. Drop
98
104
99
105
Expressions returning "needs drop" types can never be promoted. If such an
@@ -110,6 +116,9 @@ it is unlikely to be the desired behavior in most cases and very likey to be con
110
116
to the user. If such behavior is desired, the user can still use an explicit ` static `
111
117
or ` const ` item and refer to that.
112
118
119
+ * Dynamic check.* The Miri engine could dynamically check this by ensuring that
120
+ the result of computing a promoted is a value that does not need dropping.
121
+
113
122
## ` & ` in ` const ` and ` static `
114
123
115
124
Promotion is also responsible for making code like this work:
0 commit comments