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
### `#[rustc_args_required_const(...)]` and inline assembly `const` operands
39
39
40
40
Additionally, some platform intrinsics require certain parameters to be
41
41
immediates (known at compile-time). We use the `#[rustc_args_required_const]`
@@ -44,6 +44,9 @@ attribute, introduced in
44
44
specify these parameters and (aggressively, see below) try to promote the
45
45
corresponding arguments.
46
46
47
+
Similarly, inline assembly has `const` operands, which are treated the same way
48
+
as `rustc_args_required_const` arguments.
49
+
47
50
### Promotion inside `const` and `static`
48
51
49
52
Lifetime extension is also responsible for making code like this work:
@@ -96,7 +99,7 @@ declaration. We can thus be less conservative. This is called *explicit*
96
99
promotion.
97
100
98
101
Currently, the following are considered explicit promotion contexts:
99
-
*`#[rustc_args_required_const]` arguments
102
+
*`#[rustc_args_required_const]` arguments and inline assembly `const` operands
100
103
* lifetime extension in the bodies of `const` and `static` items and array lengths
101
104
* the bodies of `const fn` -- but this is not justified by the above discussion; since `const fn` can be runtime-evaluated, the concerns about introducing hard errors where there would be none apply for `const fn` in exactly the same way as for `fn`, but this was overlooked when implementing the checks
0 commit comments