File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -232,15 +232,17 @@ restrictions described above still apply for the *result* of the promoted
232232computation: in particular, it must be a valid ` const ` (i.e., it cannot
233233introduce interior mutability) and it must not require dropping.
234234
235- For instance, while the previous example was not legal, the following would be:
235+ For instance the following would be legal even though calls to ` do_it ` are not
236+ eligible for implicit promotion:
236237
237238``` rust
238- const BOOL : i32 = {
239- let ret = if cfg! (windows ) { 0 } else { 1 };
239+ const fn do_it (x : i32 ) -> i32 { 2 * x }
240+ const ANSWER : i32 = {
241+ let ret = do_it (21 );
240242 ret
241243};
242244
243- let x : & 'static i32 = & BOOL ;
245+ let x : & 'static i32 = & ANSWER ;
244246```
245247
246248An access to a ` static ` is only promotable within the initializer of another
You can’t perform that action at this time.
0 commit comments