From 35af0872451dd0659d27daf830d9b68b2134cb0f Mon Sep 17 00:00:00 2001 From: Fanyjie Date: Fri, 14 Jan 2022 14:24:12 +0800 Subject: [PATCH] pattern-match: add missed error message --- book/contents/basic/match-pattern/pattern-match.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/book/contents/basic/match-pattern/pattern-match.md b/book/contents/basic/match-pattern/pattern-match.md index 83581255..355062ad 100644 --- a/book/contents/basic/match-pattern/pattern-match.md +++ b/book/contents/basic/match-pattern/pattern-match.md @@ -90,6 +90,20 @@ let (x, y, z) = (1, 2, 3); ```rust let (x, y) = (1, 2, 3); ``` +```rust +error[E0308]: mismatched types + --> src/main.rs:4:5 + | +4 | let (x, y) = (1, 2, 3); + | ^^^^^^ --------- this expression has type `({integer}, {integer}, {integer})` + | | + | expected a tuple with 3 elements, found one with 2 elements + | + = note: expected tuple `({integer}, {integer}, {integer})` + found tuple `(_, _)` +For more information about this error, try `rustc --explain E0308`. +error: could not compile `playground` due to previous error +``` 对于元组来说,元素个数也是类型的一部分! #### 函数参数