More expressions correctly are marked to end with curly braces by GearsDatapacks · Pull Request #118880 · rust-lang/rust

@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

Dec 12, 2023

compiler-errors

compiler-errors

compiler-errors

@GearsDatapacks

…sion kinds to specify whether they contain a brace

Add inline const and other possible curly brace expressions to expr_trailing_brace

Add tests for `}` before `else` in `let...else` error

Change to explicit cases for expressions with optional values when being checked for trailing braces

Add tests for more complex cases of `}` before `else` in `let..else` statement

Move other possible `}` cases into separate arm and add FIXME for future reference

compiler-errors

@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.

S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Dec 17, 2023

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 17, 2023
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#118880 (More expressions correctly are marked to end with curly braces)
 - rust-lang#118928 (fix: Overlapping spans in delimited meta-vars)
 - rust-lang#119022 (Remove unnecessary constness from ProjectionCandidate)
 - rust-lang#119052 (Avoid overflow in GVN constant indexing.)

r? `@ghost`
`@rustbot` modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 17, 2023
Rollup merge of rust-lang#118880 - GearsDatapacks:issue-118859-fix, r=compiler-errors

More expressions correctly are marked to end with curly braces

Fixes rust-lang#118859, and replaces the mentioned match statement with an exhaustive list, so that this code doesn't get overlooked in the future

fmease added a commit to fmease/rust that referenced this pull request

May 22, 2024
Disallow cast with trailing braced macro in let-else

This fixes an edge case I noticed while porting rust-lang#118880 and rust-lang#119062 to syn.

Previously, rustc incorrectly accepted code such as:

```rust
let foo = &std::ptr::null as &'static dyn std::ops::Fn() -> *const primitive! {
    8
} else {
    return;
};
```

even though a right curl brace `}` directly before `else` in a `let...else` statement is not supposed to be valid syntax.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

May 22, 2024
Rollup merge of rust-lang#125049 - dtolnay:castbrace, r=compiler-errors

Disallow cast with trailing braced macro in let-else

This fixes an edge case I noticed while porting rust-lang#118880 and rust-lang#119062 to syn.

Previously, rustc incorrectly accepted code such as:

```rust
let foo = &std::ptr::null as &'static dyn std::ops::Fn() -> *const primitive! {
    8
} else {
    return;
};
```

even though a right curl brace `}` directly before `else` in a `let...else` statement is not supposed to be valid syntax.