Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On function and method calls in patterns, link to the book #131312

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Oct 6, 2024

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.

```
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 rust-lang#97200.
@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2024

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 6, 2024
@compiler-errors
Copy link
Member

@bors r rollup

@bors
Copy link
Contributor

bors commented Oct 6, 2024

📌 Commit 7f5548f has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 6, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 6, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#129392 (Do not consider match/let/ref of place that evaluates to `!` to diverge, disallow coercions from them too)
 - rust-lang#131279 (update "build/host" symlink comment)
 - rust-lang#131312 (On function and method calls in patterns, link to the book)
 - rust-lang#131315 (bootstrap: add `std_features` config)
 - rust-lang#131316 (Fix typo in primitive_docs.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 6, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#129392 (Do not consider match/let/ref of place that evaluates to `!` to diverge, disallow coercions from them too)
 - rust-lang#131279 (update "build/host" symlink comment)
 - rust-lang#131312 (On function and method calls in patterns, link to the book)
 - rust-lang#131315 (bootstrap: add `std_features` config)
 - rust-lang#131316 (Fix typo in primitive_docs.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 11c41ff into rust-lang:master Oct 6, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 6, 2024
Rollup merge of rust-lang#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 rust-lang#97200.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[E0532] Error when using functions in patterns should give an explanation of patterns
5 participants