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.
1212
1313## Rules
1414
15- ### 1. Panics
15+ ### Panics
1616
1717Promotion is not allowed to throw away side effects. This includes panicking.
1818Let 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
4646mode. This breaks promotion, because now promoting code that would work (and
4747could not panic!) at run-time leads to a compile-time CTFE error.
4848
49- ### 2. Const safety
49+ ### Const safety
5050
5151We have explained what happens when evaluating a promoted panics, but what about
5252other 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
8989not have decided to promote. It is the responsibility of ` foo ` to not fail this
9090way when working with const-safe arguments.
9191
92- ### 3. Constraints on constants
92+ ### Constraints on constants
9393
9494All the [ extra restrictions for constants] ( const.md ) beyond const safety also
9595apply to promoteds, for the same reason: Evaluating the expression at
9696compile-time instead of run-time should not alter program behavior.
9797
98- ### 4. Drop
98+ ### Drop
9999
100100Expressions containing "needs drop" types
101101can 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