Skip to content

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Aug 31, 2025

error[E0308]: mismatched types
  --> $DIR/expr-as-stmt.rs:81:5
   |
LL |     match () { _ => true } && match () { _ => true };
   |     ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool`
   |
help: parentheses are required to parse this as an expression
   |
LL |     (match () { _ => true }) && match () { _ => true };
   |     +                      +

Address the common case from #88727. The original parse error is still outstanding, but the cases brought up in the thread are resolved.

… { () => 1 }`

```
error[E0308]: mismatched types
  --> $DIR/expr-as-stmt.rs:69:5
   |
LL |     match () { () => 1 } + match () { () => 1 }
   |     ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer
   |
help: consider using a semicolon here
   |
LL |     match () { () => 1 }; + match () { () => 1 }
   |                         +
help: alternatively, parentheses are required to parse this as an expression
   |
LL |     (match () { () => 1 }) + match () { () => 1 }
   |     +                    +
```

Parentheses are needed for the `match` to be unambiguously parsed as an expression and not a statement when chaining with binops that are also unops.
…expression

```
error[E0308]: mismatched types
  --> $DIR/expr-as-stmt.rs:69:5
   |
LL |     match () { () => 1 } + match () { () => 1 }
   |     ^^^^^^^^^^^^^^^^^^^^ expected `()`, found integer
   |
help: parentheses are required to parse this as an expression
   |
LL |     (match () { () => 1 }) + match () { () => 1 }
   |     +                    +
```
@rustbot
Copy link
Collaborator

rustbot commented Aug 31, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
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 Aug 31, 2025
@chenyukang
Copy link
Member

r? @chenyukang

@rustbot rustbot assigned chenyukang and unassigned SparrowLii Aug 31, 2025
```
error[E0308]: mismatched types
  --> $DIR/expr-as-stmt-2.rs:15:15
   |
LL |     if true { true } else { false } && true;
   |     ----------^^^^-----------------
   |     |         |
   |     |         expected `()`, found `bool`
   |     expected this to be `()`
   |
help: parentheses are required to parse this as an expression
   |
LL |     (if true { true } else { false }) && true;
   |     +                               +
```
@estebank estebank changed the title Suggest parentheses when match expression in binop is parsed as statement Suggest parentheses when match or if expression in binop is parsed as statement Sep 2, 2025
@@ -1897,7 +1897,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
fcx.suggest_semicolon_at_end(cond_expr.span, &mut err);
}
}
};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a style lint to check this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we do.

@chenyukang
Copy link
Member

@bors r=chenyukang

@bors
Copy link
Collaborator

bors commented Sep 5, 2025

📌 Commit ff60e5c has been approved by chenyukang

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 Sep 5, 2025
@bors
Copy link
Collaborator

bors commented Sep 5, 2025

⌛ Testing commit ff60e5c with merge 9cd272d...

@bors
Copy link
Collaborator

bors commented Sep 5, 2025

☀️ Test successful - checks-actions
Approved by: chenyukang
Pushing 9cd272d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 5, 2025
@bors bors merged commit 9cd272d into rust-lang:master Sep 5, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 5, 2025
Copy link
Contributor

github-actions bot commented Sep 5, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing c559c4a (parent) -> 9cd272d (this PR)

Test differences

Show 30 test diffs

30 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 9cd272dc85320e85a8c83a1a338870de52c005f3 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. pr-check-1: 1723.2s -> 1367.4s (-20.6%)
  2. x86_64-rust-for-linux: 3063.8s -> 2552.0s (-16.7%)
  3. x86_64-gnu-llvm-19: 2791.8s -> 2447.4s (-12.3%)
  4. x86_64-gnu-tools: 3832.8s -> 3368.2s (-12.1%)
  5. i686-gnu-nopt-1: 8251.1s -> 7251.2s (-12.1%)
  6. i686-gnu-2: 5986.6s -> 5430.2s (-9.3%)
  7. aarch64-gnu-llvm-19-1: 3682.6s -> 3342.3s (-9.2%)
  8. aarch64-gnu-llvm-19-2: 2497.2s -> 2272.8s (-9.0%)
  9. i686-gnu-1: 8163.6s -> 7554.6s (-7.5%)
  10. x86_64-gnu-llvm-19-3: 6850.8s -> 6371.6s (-7.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9cd272d): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 0.6%, secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.9% [0.8%, 2.8%] 3
Regressions ❌
(secondary)
4.1% [2.3%, 5.9%] 2
Improvements ✅
(primary)
-3.3% [-3.3%, -3.3%] 1
Improvements ✅
(secondary)
-2.2% [-2.5%, -2.0%] 2
All ❌✅ (primary) 0.6% [-3.3%, 2.8%] 4

Cycles

Results (primary -1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.8% [-1.8%, -1.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.8% [-1.8%, -1.8%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 469.348s -> 466.363s (-0.64%)
Artifact size: 390.58 MiB -> 390.44 MiB (-0.03%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

6 participants