Skip to content

Commit e679523

Browse files
Make promotion section more hypothetical
1 parent 1f9d697 commit e679523

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

text/0000-inline-const.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,7 @@ It would be possible to allow the syntax `const expr` for an inline `const` that
336336
consists of a single expression. This is analagous to the single expression
337337
variant of closures: `|| 42`. This is backwards compatible with the current proposal.
338338

339-
Eventually, I would like to try making any expression that could possibly panic
340-
ineligible for implicit promotion. This includes *all* `const fn` calls as well
341-
as all arithmetic expressions (e.g., `&(0u32 - 1)`), which currently work due
342-
to [the way MIR is lowered][arith-assert]. Even though bitwise operators can
343-
never panic, I would also stop promoting them to be consistent. This would
344-
have to be done at an edition boundary. We would only do promotion for
345-
aggregates, literals, constants and combinations thereof (**@RalfJung** notes
346-
that this is the subset of the language valid in patterns), and
347-
`#[rustc_promotable]` would be ignored by later editions of the compiler.
348-
349-
[arith-assert]: https://github.com/rust-lang/const-eval/issues/19#issuecomment-447052258
339+
At some point (an edition boundary?), we may want to narrow the scope of
340+
expressions that are eligible for implicit promotion. Inline `const`
341+
expressions would be the recommended replacement for expressions that were no
342+
longer eligible.

0 commit comments

Comments
 (0)