diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-10-06 01:44:59 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-10-06 01:44:59 +0000 |
| commit | 7f5548fa8b22bccdadb3cbe7cf4d566a970eeb25 (patch) | |
| tree | 4a2cc13d33de0268e0ba0da2bab936d3c9c0538a /tests/ui/parser/issues | |
| parent | 14f303bc1430a78ddaa91b3e104bbe4c0413184e (diff) | |
| download | rust-7f5548fa8b22bccdadb3cbe7cf4d566a970eeb25.tar.gz rust-7f5548fa8b22bccdadb3cbe7cf4d566a970eeb25.zip | |
On function and method calls in patterns, link to the book
``` error: expected a pattern, found an expression --> f889.rs:3:13 | 3 | let (x, y.drop()) = (1, 2); //~ ERROR | ^^^^^^^^ not a pattern | = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> error[E0532]: expected a pattern, found a function call --> f889.rs:2:13 | 2 | let (x, drop(y)) = (1, 2); //~ ERROR | ^^^^ not a tuple struct or tuple variant | = note: function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> ``` Fix #97200.
Diffstat (limited to 'tests/ui/parser/issues')
| -rw-r--r-- | tests/ui/parser/issues/issue-24197.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-24375.stderr | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/tests/ui/parser/issues/issue-24197.stderr b/tests/ui/parser/issues/issue-24197.stderr index 7ebbf4ac370..c92e165b23b 100644 --- a/tests/ui/parser/issues/issue-24197.stderr +++ b/tests/ui/parser/issues/issue-24197.stderr @@ -2,7 +2,9 @@ error: expected a pattern, found an expression --> $DIR/issue-24197.rs:2:9 | LL | let buf[0] = 0; - | ^^^^^^ arbitrary expressions are not allowed in patterns + | ^^^^^^ not a pattern + | + = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-24375.stderr b/tests/ui/parser/issues/issue-24375.stderr index a25c277d78a..fef3fcde7b7 100644 --- a/tests/ui/parser/issues/issue-24375.stderr +++ b/tests/ui/parser/issues/issue-24375.stderr @@ -2,8 +2,9 @@ error: expected a pattern, found an expression --> $DIR/issue-24375.rs:6:9 | LL | tmp[0] => {} - | ^^^^^^ arbitrary expressions are not allowed in patterns + | ^^^^^^ not a pattern | + = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch18-00-patterns.html> help: consider moving the expression to a match arm guard | LL | val if val == tmp[0] => {} |
