File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ arithmetic.
12
12
13
13
## Rules
14
14
15
- ### 1. Panics
15
+ ### Panics
16
16
17
17
Promotion is not allowed to throw away side effects. This includes panicking.
18
18
Let us look at what happens when we promote ` &(0_usize - 1) ` in a debug build:
@@ -46,7 +46,7 @@ earlier version of miri used to panic on arithmetic overflow even in release
46
46
mode. This breaks promotion, because now promoting code that would work (and
47
47
could not panic!) at run-time leads to a compile-time CTFE error.
48
48
49
- ### 2. Const safety
49
+ ### Const safety
50
50
51
51
We have explained what happens when evaluating a promoted panics, but what about
52
52
other kinds of failure -- what about hitting an unsupported operation or
@@ -89,13 +89,13 @@ but to abort compilation of a program that would have compiled fine if we would
89
89
not have decided to promote. It is the responsibility of ` foo ` to not fail this
90
90
way when working with const-safe arguments.
91
91
92
- ### 3. Constraints on constants
92
+ ### Constraints on constants
93
93
94
94
All the [ extra restrictions for constants] ( const.md ) beyond const safety also
95
95
apply to promoteds, for the same reason: Evaluating the expression at
96
96
compile-time instead of run-time should not alter program behavior.
97
97
98
- ### 4. Drop
98
+ ### Drop
99
99
100
100
Expressions containing "needs drop" types
101
101
can never be promoted. If such an expression were promoted, the ` Drop ` impl would
You can’t perform that action at this time.
0 commit comments