diff options
| author | Sebastian Malton <sebastian@malton.name> | 2018-06-03 23:31:49 -0400 |
|---|---|---|
| committer | Jake Goulding <jake.goulding@gmail.com> | 2018-06-05 10:19:21 -0400 |
| commit | 4fe40635ef3c2cdbc2e3f62ca71f0e2235e70639 (patch) | |
| tree | 94089961baf76e9fd6ad1ce82c65de281bc74c52 /src/doc | |
| parent | 4122885e0f99b3f28e65c122cde48de5bfc8231a (diff) | |
Implementation of RFC 2086 - Allow Irrefutable Let patterns
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/irrefutable-let-pattern.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/irrefutable-let-pattern.md b/src/doc/unstable-book/src/language-features/irrefutable-let-pattern.md new file mode 100644 index 00000000000..13681c96811 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/irrefutable-let-pattern.md @@ -0,0 +1,23 @@ +# `irrefutable_let_pattern` + +The tracking issue for this feature is: [#44495] + +[#44495]: https://github.com/rust-lang/rust/issues/44495 + +------------------------ + +This feature changes the way that the irrefutable pattern is handled +in the `if let` and `while let` forms. The old way was to always error +but now with a tag the error-by-default lint can be switched off. + +```rust +#![feature(irrefutable_let_pattern)] + +fn main() { + #[allow(irrefutable_let_pattern)] + if let _ = 5 {} + + #[allow(irrefutable_let_pattern)] + while let _ = 5 {} +} +``` |
