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

use Span::find_ancestor_inside to get right span in CastCheck #95920

Merged
merged 1 commit into from
Apr 12, 2022

Conversation

compiler-errors
Copy link
Member

This is a quick fix. This bad suggestion likely lives in other places... but thought it would be useful to fix all of the CastCheck ones first.

Let me know if reviewer would prefer I add more tests for each of the diagnostics in CastCheck, or would like to do a more thorough review of other suggestions that use spans in typeck. I would also be open to further suggestions on how to better expose an API that gives us the "best" span for a diagnostic suggestion.

Fixed #95919

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

r? @oli-obk

(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 Apr 11, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Apr 11, 2022

I think we can fix these on a case by case basis and see if we come up with a general solution at some later point. It's pretty hard to know the intention, although if the macro is from another crate we should be reporting the invocation site unconditionally

@bors r+ rolluo

@compiler-errors
Copy link
Member Author

@bors rollup

@compiler-errors
Copy link
Member Author

oh this never got approved, lol

@bors r=oli-obk rollup

@bors
Copy link
Contributor

bors commented Apr 11, 2022

📌 Commit d2b1bb8 has been approved by oli-obk

@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 Apr 11, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 12, 2022
…n, r=oli-obk

use `Span::find_ancestor_inside` to get right span in CastCheck

This is a quick fix. This bad suggestion likely lives in other places... but thought it would be useful to fix all of the CastCheck ones first.

Let me know if reviewer would prefer I add more tests for each of the diagnostics in CastCheck, or would like to do a more thorough review of other suggestions that use spans in typeck. I would also be open to further suggestions on how to better expose an API that gives us the "best" span for a diagnostic suggestion.

Fixed rust-lang#95919
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 12, 2022
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#95320 (Document the current MIR semantics that are clear from existing code)
 - rust-lang#95722 (pre-push.sh: Use python3 if python is not found)
 - rust-lang#95881 (Use `to_string` instead of `format!`)
 - rust-lang#95909 (rustdoc: Reduce allocations in a `theme` function)
 - rust-lang#95910 (Fix crate_type attribute to not warn on duplicates)
 - rust-lang#95920 (use `Span::find_ancestor_inside` to get right span in CastCheck)
 - rust-lang#95936 (Fix a bad error message for `relative paths are not supported in visibilities` error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8d46f9c into rust-lang:master Apr 12, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 12, 2022
@compiler-errors compiler-errors deleted the cast-suggestion-span branch August 11, 2023 19:56
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.

Suggestion for fuzzy_provenance_casts on a macro uses its expansion
5 participants