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

Point at LHS on binop type err if relevant #105192

Merged
merged 1 commit into from
Dec 10, 2022

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Dec 2, 2022

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2022

r? @fee1-dead

(rustbot has picked a reviewer for you, use r? to override)

@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 2, 2022
Comment on lines 89 to 93
LL | assert_eq!(3i32, &3i32);
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32`
| ^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected `i32`, found `&i32`
| expected because of this binary operation left hand side expression
Copy link
Member

Choose a reason for hiding this comment

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

I find this to be confusing. Can we not add this note if the binop is within a macro expansion, or maybe find a way to actually point at 3i32 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't point at the macro argument because the macro machinery doesn't have enough intelligence yet to do that once its gone though any expression. In this case the macro expands to something that loses the span. That is a project that I've tried to tackle in the past and will not be fixed anytime soon, sadly.

{
err.span_label(
lhs.span,
"expected because of this binary operation left hand side expression",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"expected because of this binary operation left hand side expression",
"expected due to this binary operation left hand side expression",

Since the label is a bit lengthy will it make sense to cut it shorter?

| ^^^^^^^^ expected `usize`, found `isize`
| ------- ^^^^^^^^ expected `usize`, found `isize`
| |
| expected because of this binary operation left hand side expression
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could say something like "expected because the left-hand side is $TY"?

Unrelated, I feel like "binary operation left hand side expression" is a lot of words but not necessarily clearer than just "left-hand side".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the wording to be "expected because this is Ty", that should be understandable while also short and jargon-free.

@fee1-dead
Copy link
Member

Implementation looks fine, should be good to go after addressing the comments

@rustbot author

@rustbot rustbot 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 Dec 8, 2022
@estebank estebank 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 8, 2022
@fee1-dead
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 10, 2022

📌 Commit 132a140 has been approved by fee1-dead

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 Dec 10, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 10, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#104460 (Migrate parts of `rustc_expand` to session diagnostics)
 - rust-lang#105192 (Point at LHS on binop type err if relevant)
 - rust-lang#105234 (Remove unneeded field from `SwitchTargets`)
 - rust-lang#105239 (Avoid heap allocation when truncating thread names)
 - rust-lang#105410 (Consider `parent_count` for const param defaults)
 - rust-lang#105482 (Fix invalid codegen during debuginfo lowering)

Failed merges:

 - rust-lang#105411 (Introduce `with_forced_trimmed_paths`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7e1857d into rust-lang:master Dec 10, 2022
@rustbot rustbot added this to the 1.68.0 milestone Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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