diff options
| author | Ruud van Asseldonk <dev@veniogames.com> | 2015-04-14 19:39:58 +0200 |
|---|---|---|
| committer | Ruud van Asseldonk <dev@veniogames.com> | 2015-04-14 19:39:58 +0200 |
| commit | 48a376da18b27c787818eec18ad26ba96ebdff67 (patch) | |
| tree | 32359905ed0794083a37c21c4be9785c2b3df897 /src | |
| parent | ab1723b6704f31390a55a160955240aef817c8b3 (diff) | |
| download | rust-48a376da18b27c787818eec18ad26ba96ebdff67.tar.gz rust-48a376da18b27c787818eec18ad26ba96ebdff67.zip | |
rustc: Add long diagnostics for E0302
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/diagnostics.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 3495f8eb160..7f77c0fceea 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -153,6 +153,20 @@ match Some(()) { } "##, +E0302: r##" +Assignments are not allowed in pattern guards, because matching cannot have +side effects. Side effects could alter the matched object or the environment +on which the match depends in such a way, that the match would not be +exhaustive. For instance, the following would not match any arm if assignments +were allowed: + +match Some(()) { + None => { }, + option if { option = None; false } { }, + Some(_) => { } // When the previous match failed, the option became `None`. +} +"##, + E0303: r##" In certain cases it is possible for sub-bindings to violate memory safety. Updates to the borrow checker in a future version of Rust may remove this @@ -238,7 +252,6 @@ register_diagnostics! { E0298, // mismatched types between arms E0299, // mismatched types between arms E0300, // unexpanded macro - E0302, // cannot assign in a pattern guard E0304, // expected signed integer constant E0305, // expected constant E0306, // expected positive integer for repeat count |
