Skip to content

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Feb 17, 2022

closes #93829

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 17, 2022
@rust-highfive
Copy link
Contributor

r? @scottmcm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 17, 2022
@TaKO8Ki TaKO8Ki changed the title Suggest a float literal when dividing a floating-point type by {integer} Suggest a float literal when dividing a floating-point type by {integer} Feb 17, 2022
@scottmcm scottmcm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2022
@SNCPlay42
Copy link
Contributor

This seems reasonable to do for the other arithmetic operators as well.

@scottmcm
Copy link
Member

@TaKO8Ki Do you want to try to take on the change to make this an in-the-compiler suggestion with a structured fix, as @joshtriplett mentions? Or would you rather check this in as a quick improvement and leave the fancier suggestion to someone later?

@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Feb 19, 2022

@scottmcm I am going to take on it and I think I can do it myself!

@TaKO8Ki TaKO8Ki force-pushed the suggest-float-literal-for-float-divided-by-integer branch from 3ab9a90 to 2078608 Compare February 20, 2022 04:01
@rust-log-analyzer

This comment has been minimized.

@scottmcm
Copy link
Member

I'm not a compiler reviewer, so I'll re-roll someone who actually know how these things are done:

r? rust-lang/diagnostics

@rust-highfive rust-highfive assigned estebank and unassigned scottmcm Feb 20, 2022
@rust-log-analyzer

This comment has been minimized.

@TaKO8Ki TaKO8Ki force-pushed the suggest-float-literal-for-float-divided-by-integer branch from 8ed46d9 to 24b200c Compare February 20, 2022 06:04
@TaKO8Ki TaKO8Ki force-pushed the suggest-float-literal-for-float-divided-by-integer branch 2 times, most recently from 552bd32 to 5511c50 Compare February 24, 2022 08:35
@rust-log-analyzer

This comment has been minimized.

@TaKO8Ki TaKO8Ki force-pushed the suggest-float-literal-for-float-divided-by-integer branch from 5511c50 to 758d55c Compare February 24, 2022 09:33
@estebank
Copy link
Contributor

The new approach is much cleaner! I have only one nitpick around code duplication, but once we've addressed that I'm ready for merging.

@estebank
Copy link
Contributor

Awesome! One last thing, could you squash your commits?

@TaKO8Ki TaKO8Ki force-pushed the suggest-float-literal-for-float-divided-by-integer branch from aec2413 to d151d07 Compare February 24, 2022 12:39
@TaKO8Ki TaKO8Ki requested a review from estebank February 24, 2022 16:49
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Feb 25, 2022

@estebank
I squashed my commits!

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 25, 2022

📌 Commit d151d07 has been approved by estebank

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 25, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 25, 2022
…loat-divided-by-integer, r=estebank

Suggest a float literal when dividing a floating-point type by `{integer}`

closes rust-lang#93829
@matthiaskrgr
Copy link
Member

Hmm, might need a rebase after #93368 (see #94367 (comment) )

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 26, 2022
…loat-divided-by-integer, r=estebank

Suggest a float literal when dividing a floating-point type by `{integer}`

closes rust-lang#93829
fix a message

implement a rustfix-applicable suggestion

implement `suggest_floating_point_literal`

add `ObligationCauseCode::BinOp`

remove duplicate code

fix function names in uitests

use `Diagnostic` instead of `DiagnosticBuilder`
@TaKO8Ki TaKO8Ki force-pushed the suggest-float-literal-for-float-divided-by-integer branch from d151d07 to c60bae7 Compare February 26, 2022 05:29
@TaKO8Ki
Copy link
Member Author

TaKO8Ki commented Feb 26, 2022

I solved this problem. Could you please review it again? @estebank
cc: @matthiaskrgr

ref: #94078 (comment)

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 26, 2022

📌 Commit c60bae7 has been approved by estebank

@bors
Copy link
Collaborator

bors commented Feb 26, 2022

⌛ Testing commit c60bae7 with merge 8c9640e...

@bors
Copy link
Collaborator

bors commented Feb 26, 2022

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 26, 2022
@bors bors merged commit 8c9640e into rust-lang:master Feb 26, 2022
@rustbot rustbot added this to the 1.61.0 milestone Feb 26, 2022
@TaKO8Ki TaKO8Ki deleted the suggest-float-literal-for-float-divided-by-integer branch February 26, 2022 14:24
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8c9640e): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

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.

Suggest a float literal when dividing a floating-point type by {integer}