Skip to content

Commit a8544cc

Browse files
authored
Merge pull request #59 from RalfJung/promotion
union accesses are not promoted anywhere any more
2 parents 18ffab1 + 0772b7e commit a8544cc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

promotion.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,11 @@ promotion.
7070

7171
Currently, the following are considered explicit promotion contexts:
7272
* `#[rustc_args_required_const]` arguments and inline assembly `const` operands everywhere.
73-
* Everything inside the bodies of `const` and `static` items. (Note: this is handled separately from "explicit contexts" in promotion analysis, but the effect is the same.)
73+
* Everything inside the bodies of `const` and `static` items. (Note: this is handled separately from "explicit contexts" in promotion analysis, but the effect is the same.
74+
The arguments given above for justifying explicit promotion do not apply here. Currently, this works out because failing to evaluate one of these promoteds just leads to a warning, but longer-term it would be desirable to turn evaluation failures into hard errors, which for these promoteds means we have to guarantee that we only evaluate them on-demand.)
7475

7576
In these contexts, we promote calls to arbitrary `const fn`.
7677

77-
There is one further special case for the bodies of `const` and `static` items; here we additionally promote union field accesses.
78-
Both of these special cases can lead to promoting things that can fail to evaluate.
79-
Currently, this works out because it just leads to a warning, but longer-term it would be desirable to turn evaluation failures into hard errors, which for these promoteds means we have to guarantee that we only evaluate them on-demand.
80-
8178
[See below][static access] for another special case in promotion analysis:
8279
accesses and references to statics are only promoted inside other statics.
8380

0 commit comments

Comments
 (0)