4
5```compile_fail,E0764
6▶fn main() {
7 const OH_NO: &'static mut usize = &mut 1; // error!
8}
· · ·
9```
10
11▶Mutable references (`&mut`) can only be used in constant functions, not statics
12or constants. This limitation exists to prevent the creation of constants that
13have a mutable reference in their final value. If you had a constant of
· · ·
21references.
22
23▶Remember: you cannot use a function call inside a constant or static. However,
24you can totally use it in constant functions:
25
· · ·
24▶you can totally use it in constant functions:
25
26```
· · ·
32}
33
34▶fn main() {
35 const FOO: usize = foo(10); // ok!
36}