about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-10-06 01:44:59 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-10-06 01:44:59 +0000
commit7f5548fa8b22bccdadb3cbe7cf4d566a970eeb25 (patch)
tree4a2cc13d33de0268e0ba0da2bab936d3c9c0538a /compiler/rustc_parse/src/errors.rs
parent14f303bc1430a78ddaa91b3e104bbe4c0413184e (diff)
downloadrust-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 'compiler/rustc_parse/src/errors.rs')
-rw-r--r--compiler/rustc_parse/src/errors.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs
index 40502158469..dade3912751 100644
--- a/compiler/rustc_parse/src/errors.rs
+++ b/compiler/rustc_parse/src/errors.rs
@@ -2608,6 +2608,7 @@ pub(crate) struct ExpectedCommaAfterPatternField {
 
 #[derive(Diagnostic)]
 #[diag(parse_unexpected_expr_in_pat)]
+#[note]
 pub(crate) struct UnexpectedExpressionInPattern {
     /// The unexpected expr's span.
     #[primary_span]