1 A constant item was initialized with something that is not a constant
4 Erroneous code example:
7 fn create_some() -> Option<u8> {
11 const FOO: Option<u8> = create_some(); // error!
14 The only functions that can be called in static or constant expressions are
15 `const` functions, and struct/enum constructors.
17 To fix this error, you can declare `create_some` as a constant function:
20 const fn create_some() -> Option<u8> { // declared as a const function
24 const FOO: Option<u8> = create_some(); // ok!
26 // These are also working:
31 const OTHER_FOO: Option<u8> = Some(1);
32 const BAR: Bar = Bar {x: 1};