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

Do not remove semicolon if it changes the block type #14103

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

samueltardieu
Copy link
Contributor

Removing the semicolon of the last statement of an expressionless block may change the block type even if the statement's type is (). If the block type is ! because of a systematic early return, typing it as () may make it incompatible with the expected type for the block (to which ! is cast).

Fix #14100

changelog: [unnecessary_semicolon]: do not remove semicolon if it could change the block type from ! to ()

Removing the semicolon of the last statement of an expressionless block
may change the block type even if the statement's type is `()`. If the
block type is `!` because of a systematic early return, typing it as
`()` may make it incompatible with the expected type for the block (to
which `!` is cast).
@rustbot
Copy link
Collaborator

rustbot commented Jan 29, 2025

r? @dswij

rustbot has assigned @dswij.
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 the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 29, 2025
@dswij dswij added this pull request to the merge queue Jan 31, 2025
Merged via the queue into rust-lang:master with commit d79f862 Jan 31, 2025
11 checks passed
@samueltardieu samueltardieu deleted the push-ryqrqzyvrzky branch January 31, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FP unnecessary-semicolon
3 participants