You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4b4e01f
Browse filesBrowse the repository at this point in the historyBrowse files
2203](https://github.com/rust-rfcs/const-eval/blob/master/const.md). In this
33
+
case, we try to promote the initializer in expressions like `[Vec::new(); 32]`,
34
+
which allows non-`Copy` types to be used as array initializers.
35
+
36
+
### `#[rustc_args_required_const(...)]`
37
+
38
+
Additionally, some platform intrinsics require certain operations to be
39
+
immediates (known at compile-time). We use the `#[rustc_args_required_const]`
40
+
attribute, introduced in
41
+
[rust-lang/rust#48018](https://github.com/rust-lang/rust/pull/48018), to
42
+
specify these parameters and (aggressively, see below) try to promote the
43
+
corresponding arguments.
44
+
45
+
### Implicit and explicit contexts
46
+
13
47
On top of what applies to [consts](const.md), promoteds suffer from the additional issue that *the user did not ask for them to be evaluated at compile-time*.
14
48
Thus, if CTFE fails but the code would have worked fine at run-time, we broke the user's code for no good reason.
15
49
Even if we are sure we found an error in the user's code, we are only allowed to [emit a warning, not a hard error][warn-rfc].
16
50
That's why we have to be very conservative with what can and cannot be promoted.
0 commit comments