Skip to content

Commit 660e8f8

Browse files
committed
---
yaml --- r: 221821 b: refs/heads/auto c: 37a84bc h: refs/heads/master i: 221819: 8720a08 v: v3
1 parent a1aa0d9 commit 660e8f8

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 5d31deeae43e8f3803604f837649bbaeb625e726
11+
refs/heads/auto: 37a84bc82169bfdd0c67c519e710ba4488b82d55
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc/diagnostics.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ fn main() {
375375
```
376376
377377
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:
379379
380380
```
381381
fn main() {
@@ -392,6 +392,24 @@ This error indicates that an attempt was made to divide by zero (or take the
392392
remainder of a zero divisor) in a static or constant expression.
393393
"##,
394394

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+
395413
E0030: r##"
396414
When matching against a range, the compiler verifies that the range is
397415
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`).
12771295

12781296
register_diagnostics! {
12791297
// E0006 // merged with E0005
1280-
E0022,
12811298
E0038,
12821299
// E0134,
12831300
// E0135,

0 commit comments

Comments
 (0)