@@ -226,8 +226,8 @@ the result of computing a promoted is a value that does not need dropping.
226226
227227### Access to a ` const ` or ` static `
228228
229- When accessing a ` const ` in a promotable context, its value anyway gets computed
230- at compile-time, so we do not have to check the initializer. However, the
229+ When accessing a ` const ` in a promotable context, its value gets computed
230+ at compile-time anyway , so we do not have to check the initializer. However, the
231231restrictions described above still apply for the * result* of the promoted
232232computation: in particular, it must be a valid ` const ` (i.e., it cannot
233233introduce interior mutability) and it must not require dropping.
@@ -272,12 +272,13 @@ const context, the user likely expects that `x` will live on the stack and be
272272initialized at run-time. Although this is not (to my knowledge) guaranteed by
273273the language, we do not wish to violate the user's expectations here.
274274
275- However, constant-folding still applies: the optimizer may compute ` x ` at
275+ Note that constant-folding still applies: the optimizer may compute ` x ` at
276276compile-time and even inline it everywhere if it can show that this does not
277277observably alter program behavior. Promotion is very different from
278278constant-folding as promotion can introduce observable differences in behavior
279279(if const-evaluation fails) and as it is * guaranteed* to happen in some cases
280- (and thus exploited by the borrow checker).
280+ (and thus exploited by the borrow checker). This is reflected in the fact that
281+ promotion affects lifetimes, but constant folding does not.
281282
282283### Single assignment
283284
0 commit comments