Skip to content

Commit 7153ee9

Browse files
committed
expand
1 parent 1ca2c1b commit 7153ee9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

promotion.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ limitation with the CTFE engine. While writing `let x = {expr}` outside of a
122122
const context, the user likely expects that `x` will live on the stack and be
123123
initialized at run-time. Although this is not (to my knowledge) guaranteed by
124124
the language, we do not wish to violate the user's expectations here.
125-
(Constant-folding still applies: the optimizer may compute `x` at compile-time
126-
and even inline it everywhere if it can show that this does not observably alter
127-
program behavior. Promotion is very different from constant-folding as
128-
promotion can introduce observable differences in behavior.)
125+
126+
However, constant-folding still applies: the optimizer may compute `x` at
127+
compile-time and even inline it everywhere if it can show that this does not
128+
observably alter program behavior. Promotion is very different from
129+
constant-folding as promotion can introduce observable differences in behavior
130+
(if const-evaluation fails) and as it is *guaranteed* to happen in some cases
131+
(and thus exploited by the borrow checker).
129132

130133
### Single assignment
131134

0 commit comments

Comments
 (0)