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

Suggest => --> >= in comparisons #117303

Merged
merged 1 commit into from
Dec 27, 2023
Merged

Suggest => --> >= in comparisons #117303

merged 1 commit into from
Dec 27, 2023

Conversation

sjwang05
Copy link
Contributor

Fixes #117245

@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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 28, 2023
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

I don't think this handles cases where the condition is chained with &&, right? What about cases where this isn't an if block at all? What about cases where we're comparing against a literal (=> 1)?

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 28, 2023
@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2023

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git rebase -i master
$ # delete any merge commits in the editor that appears
$ git push --force-with-lease

The following commits are merge commits:

@sjwang05 sjwang05 marked this pull request as draft October 28, 2023 05:18
@rust-log-analyzer

This comment has been minimized.

@sjwang05
Copy link
Contributor Author

sjwang05 commented Oct 28, 2023

Thanks for the feedback! Chaining with || and && worked, but the other cases you mentioned didn't. I believe I have everything covered now--I was previously struggling with not breaking match parsing. Nevermind, looks like I missed some additional edge cases. I've also added additional tests to cover for these cases.

@sjwang05 sjwang05 marked this pull request as ready for review October 28, 2023 20:17
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 10, 2023

☔ The latest upstream changes (presumably #117769) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

Please squash rebase on top of a recent master.

compiler/rustc_parse/src/parser/diagnostics.rs Outdated Show resolved Hide resolved
tests/ui/parser/eq-gt-to-gt-eq.rs Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@Noratrieb Noratrieb removed the has-merge-commits PR has merge commits, merge with caution. label Dec 16, 2023
@Noratrieb
Copy link
Member

I tried to rebase and bless the tests for you, but there seems to be something wrong still:

--- stderr -------------------------------
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `=>`
  --> /home/nils/projects/rust/tests/ui/parser/eq-gt-to-gt-eq.fixed:36:15
   |
LL |     let _ = a => b; //~ERROR
   |               ^^ expected one of 8 possible tokens

error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `=>`
  --> /home/nils/projects/rust/tests/ui/parser/eq-gt-to-gt-eq.fixed:42:13
   |
LL |     match a => b { //~ERROR
   |     -----   ^^ expected one of `!`, `.`, `::`, `?`, `{`, or an operator
   |     |
   |     while parsing this `match` expression

error: aborting due to 2 previous errors
------------------------------------------

looks like it doesn't apply the fix properly for all the cases, only for some.

@Noratrieb Noratrieb removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 16, 2023
@sjwang05
Copy link
Contributor Author

Thanks for the help, and sorry for dragging my feet on this--things have been keeping me pretty busy for the past few weeks. I've updated the recovery code + test output to catch more cases while hopefully keeping false positives low.

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 27, 2023
@estebank
Copy link
Contributor

r? @estebank

@bors r+

@bors
Copy link
Contributor

bors commented Dec 27, 2023

📌 Commit 97cf1c8 has been approved by estebank

It is now in the queue for this repository.

@rustbot rustbot assigned estebank and unassigned wesleywiser Dec 27, 2023
@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 Dec 27, 2023
@bors
Copy link
Contributor

bors commented Dec 27, 2023

⌛ Testing commit 97cf1c8 with merge a861c89...

@bors
Copy link
Contributor

bors commented Dec 27, 2023

☀️ Test successful - checks-actions
Approved by: estebank
Pushing a861c89 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 27, 2023
@bors bors merged commit a861c89 into rust-lang:master Dec 27, 2023
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Dec 27, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a861c89): 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

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-1.8%, -0.5%] 4
Improvements ✅
(secondary)
-0.9% [-1.0%, -0.7%] 2
All ❌✅ (primary) -0.9% [-1.8%, -0.5%] 4

Binary size

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

Bootstrap: 670.827s -> 670.98s (0.02%)
Artifact size: 312.33 MiB -> 312.28 MiB (-0.01%)

@sjwang05 sjwang05 deleted the issue-117245 branch January 16, 2024 03:18
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.

Detect >= to => typo in comparisons
9 participants