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

New lint: Raw slice pointer cast #9247

Merged
merged 2 commits into from
Aug 29, 2022

Conversation

clubby789
Copy link
Contributor

@clubby789 clubby789 commented Jul 26, 2022

Adds a lint to check for a raw slice being created and cast back to a pointer, suggesting ptr::slice_from_raw_parts, to identify UB such as thomcc/rust-typed-arena#54.

changelog: [`cast_slice_from_raw_parts`]: Add lint to check for `slice::from_raw_parts(.., ..) as *const _`

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Alexendoo (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 26, 2022
@clubby789 clubby789 changed the title Raw slice pointer cast New lint: Raw slice pointer cast Jul 26, 2022
@clubby789 clubby789 marked this pull request as draft July 26, 2022 19:36
@clubby789 clubby789 marked this pull request as ready for review July 27, 2022 00:44
@Alexendoo
Copy link
Member

Hi @clubby789, welcome to Clippy! The lint looks good, thanks for the PR

clippy_lints/src/casts/raw_slice_pointer_cast.rs Outdated Show resolved Hide resolved
clippy_lints/src/casts/mod.rs Outdated Show resolved Hide resolved
@bors
Copy link
Collaborator

bors commented Aug 19, 2022

☔ The latest upstream changes (presumably #8957) made this pull request unmergeable. Please resolve the merge conflicts.

Co-authored-by: Alex Macleod <alex@macleod.io>
@Alexendoo
Copy link
Member

Looks good, thank you for the lint!

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 29, 2022

📌 Commit cc9f203 has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 29, 2022

⌛ Testing commit cc9f203 with merge e9f7ce1...

@bors
Copy link
Collaborator

bors commented Aug 29, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing e9f7ce1 to master...

@bors bors merged commit e9f7ce1 into rust-lang:master Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants