1 A non-`const` function was called in a `const` context.
3 Erroneous code example:
6 fn create_some() -> Option<u8> {
10 // error: cannot call non-const fn `create_some` in constants
11 const FOO: Option<u8> = create_some();
14 All functions used in a `const` context (constant or static expression) must
17 To fix this error, you can declare `create_some` as a constant function:
20 // declared as a `const` function:
21 const fn create_some() -> Option<u8> {
25 const FOO: Option<u8> = create_some(); // no error!