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

Extend cast_ptr_alignment lint for pointer::cast method #4708

Closed
tesuji opened this issue Oct 20, 2019 · 3 comments · Fixed by #6557
Closed

Extend cast_ptr_alignment lint for pointer::cast method #4708

tesuji opened this issue Oct 20, 2019 · 3 comments · Fixed by #6557
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@tesuji
Copy link
Contributor

tesuji commented Oct 20, 2019

Extend https://rust-lang.github.io/rust-clippy/master/index.html#cast_ptr_alignment lint for pointer::cast method.

@hellow554
Copy link
Contributor

hellow554 commented Oct 21, 2019

I think one could go one step further:
forbid using as to cast between pointers (because it allows you to cast a *const to *mut without complaining, which is hilarious. cast forbids that, because of the signature of the method.

@flip1995 flip1995 added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions labels Oct 21, 2019
@jfrimmel
Copy link

forbid using as to cast between pointers

I think, maybe that should be a new lint in the restriction group then. What do you think?

@hellow554
Copy link
Contributor

that should be a new lint

Which can deprecate the old one? Sounds good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants