File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
branches/try/src/librustc Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
3
3
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4
- refs/heads/try: 5d31deeae43e8f3803604f837649bbaeb625e726
4
+ refs/heads/try: 37a84bc82169bfdd0c67c519e710ba4488b82d55
5
5
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
6
6
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
7
7
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ fn main() {
375
375
```
376
376
377
377
Remember: you can't use a function call inside a const's initialization
378
- expression! However, you can totally use it elsewhere you want :
378
+ expression! However, you can totally use it anywhere else :
379
379
380
380
```
381
381
fn main() {
@@ -392,6 +392,24 @@ This error indicates that an attempt was made to divide by zero (or take the
392
392
remainder of a zero divisor) in a static or constant expression.
393
393
"## ,
394
394
395
+ E0022 : r##"
396
+ Constant functions are not allowed to mutate anything. Thus, binding to an
397
+ argument with a mutable pattern is not allowed. For example,
398
+
399
+ ```
400
+ const fn foo(mut x: u8) {
401
+ // do stuff
402
+ }
403
+ ```
404
+
405
+ is bad because the function body may not mutate `x`.
406
+
407
+ Remove any mutable bindings from the argument list to fix this error. In case
408
+ you need to mutate the argument, try lazily initializing a global variable
409
+ instead of using a const fn, or refactoring the code to a functional style to
410
+ avoid mutation if possible.
411
+ "## ,
412
+
395
413
E0030 : r##"
396
414
When matching against a range, the compiler verifies that the range is
397
415
non-empty. Range patterns include both end-points, so this is equivalent to
@@ -1277,7 +1295,6 @@ contain references (with a maximum lifetime of `'a`).
1277
1295
1278
1296
register_diagnostics ! {
1279
1297
// E0006 // merged with E0005
1280
- E0022 ,
1281
1298
E0038 ,
1282
1299
// E0134,
1283
1300
// E0135,
You can’t perform that action at this time.
0 commit comments