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

Improve suggestion when casting usize to (possibly) wide pointer #92150

Merged

Conversation

compiler-errors
Copy link
Member

I thought #92125 was a wonderful idea, so I went ahead and took a stab at it. Not sure if my approach is the best going forward, but I'm happy with the improvement in the error message.

Iwill definitely address any changes if people are more opinionated with the wordings or want more features.

Also, do I need to add a new error code?

(Fixes #92125)

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

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

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 21, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 21, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2022
@compiler-errors
Copy link
Member Author

@matthewjasper, do you plan on reviewing this any time soon? If not, do you mind reassigning?

@compiler-errors
Copy link
Member Author

it's been some time since this got a review
r? rust-lang/compiler

src/test/ui/cast/fat-ptr-cast.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/cast.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/cast.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/cast.rs Outdated Show resolved Hide resolved
compiler/rustc_typeck/src/check/cast.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov 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 25, 2022
@compiler-errors
Copy link
Member Author

Addressed comments!

@rustbot ready

@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 Feb 25, 2022
@petrochenkov petrochenkov 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 Mar 5, 2022
@compiler-errors
Copy link
Member Author

Actually there's no reason why we need to limit this diagnostic to isize/usize. We allow all int types => thin pointer. Also simplifies the PR.

@rustbot ready

@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 Mar 9, 2022
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 10, 2022

📌 Commit 814c18a has been approved by petrochenkov

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

Rollup of 5 pull requests

Successful merges:

 - rust-lang#92150 (Improve suggestion when casting usize to (possibly) wide pointer)
 - rust-lang#94635 (Merge `#[deprecated]` and `#[rustc_deprecated]`)
 - rust-lang#94657 (Constify `Index{,Mut}` for `[T]`, `str`, and `[T; N]`)
 - rust-lang#94746 (diagnostics: use rustc_on_unimplemented to recommend `[].iter()`)
 - rust-lang#94788 (Account for suggestions for complete removal of lines)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7473750 into rust-lang:master Mar 10, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 10, 2022
@compiler-errors compiler-errors deleted the better_usize_to_wide_ptr_cast branch April 7, 2022 04:36
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.

Insufficient diagnostic info when casting usize to fat pointer
7 participants