diff options
| author | Ruud van Asseldonk <dev@veniogames.com> | 2015-04-14 19:31:42 +0200 |
|---|---|---|
| committer | Ruud van Asseldonk <dev@veniogames.com> | 2015-04-14 19:32:01 +0200 |
| commit | ab1723b6704f31390a55a160955240aef817c8b3 (patch) | |
| tree | e8ae236cbad02b0137a9e94d7233f11bfe4f9d93 | |
| parent | 9c6f4b6d1d57ef53886034b91f46e09f892a2851 (diff) | |
rustc: Add long diagnostics for E0301
| -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 63d10a83751..3495f8eb160 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -139,6 +139,20 @@ for item in xs { } "##, +E0301: r##" +Mutable borrows 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 mutable +borrows were allowed: + +match Some(()) { + None => { }, + option if option.take().is_none() => { /* impossible, option is `Some` */ }, + 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 @@ -224,7 +238,6 @@ register_diagnostics! { E0298, // mismatched types between arms E0299, // mismatched types between arms E0300, // unexpanded macro - E0301, // cannot mutable borrow in a pattern guard E0302, // cannot assign in a pattern guard E0304, // expected signed integer constant E0305, // expected constant |
