File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ E0016: include_str!("./error_codes/E0016.md"),
2525E0017 : include_str!( "./error_codes/E0017.md" ) ,
2626E0018 : include_str!( "./error_codes/E0018.md" ) ,
2727E0019 : include_str!( "./error_codes/E0019.md" ) ,
28+ E0022 : include_str!( "./error_codes/E0022.md" ) ,
2829E0023 : include_str!( "./error_codes/E0023.md" ) ,
2930E0025 : include_str!( "./error_codes/E0025.md" ) ,
3031E0026 : include_str!( "./error_codes/E0026.md" ) ,
Original file line number Diff line number Diff line change 1+ #### Note: this error code is no longer emitted by the compiler.
2+
3+ Constant functions are not allowed to mutate anything. Thus, binding to an
4+ argument with a mutable pattern is not allowed. For example,
5+
6+ ```
7+ const fn foo(mut x: u8) {
8+ // do stuff
9+ }
10+ ```
11+
12+ Is incorrect because the function body may not mutate ` x ` .
13+
14+ Remove any mutable bindings from the argument list to fix this error. In case
15+ you need to mutate the argument, try lazily initializing a global variable
16+ instead of using a ` const fn ` , or refactoring the code to a functional style to
17+ avoid mutation if possible.
You can’t perform that action at this time.
0 commit comments