rustc: Add long diagnostics for E0301
This commit is contained in:
parent
9c6f4b6d1d
commit
ab1723b670
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user