diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-06 11:06:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-06 11:06:58 +0200 |
| commit | 11c41ff1651f91de5b33df48a662fcb7c904edae (patch) | |
| tree | a33d7fd4b9f1db4ab8d5c8821c5477ca92ef023c /compiler/rustc_parse/src | |
| parent | aa546f9a7366029fe97e4f38c4ff4c1c7cd68d02 (diff) | |
| parent | 7f5548fa8b22bccdadb3cbe7cf4d566a970eeb25 (diff) | |
| download | rust-11c41ff1651f91de5b33df48a662fcb7c904edae.tar.gz rust-11c41ff1651f91de5b33df48a662fcb7c904edae.zip | |
Rollup merge of #131312 - estebank:fn-in-pattern, r=compiler-errors
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); | ^^^^^^^^ 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); | ^^^^ 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')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 1 |
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] |
