Skip to content

Commit 7f8c81c

Browse files
committed
mention rustc_promotable attribute
1 parent 53d0200 commit 7f8c81c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

promotion.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ everything, so the only possible remaining failure are panics.
7272

7373
However, things get more tricky when `const` and `const fn` are involved.
7474

75-
For `const`, based on the const safety check described [here](const_safety.md),
75+
For `const`, based on the const safety check described [here](const_safety.md#const-safety-check-on-values),
7676
we can rely on there not being const-unsafe values in the `const`, so we should
7777
be able to promote freely. For example:
7878

@@ -99,6 +99,9 @@ but to abort compilation of a program that would have compiled fine if we would
9999
not have decided to promote. It is the responsibility of `foo` to not fail this
100100
way when working with const-safe arguments.
101101

102+
For this reason, only `const fn` that were explicitly marked with the
103+
`#[rustc_promotable]` attribute are subject to promotion.
104+
102105
*Dynamic check.* The Miri engine already dynamically detects const safety
103106
violations, but the main point of promoteds is ruling them out statically.
104107

0 commit comments

Comments
 (0)