Skip to content

Conversation

aaron-ang
Copy link
Contributor

@aaron-ang aaron-ang commented Jan 30, 2025

close #2177

changelog: [manual_dangling_ptr]: new lint

@rustbot
Copy link
Collaborator

rustbot commented Jan 30, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 30, 2025
@aaron-ang aaron-ang force-pushed the cast-dangling branch 4 times, most recently from 8c0a1b3 to 69fe9bb Compare January 30, 2025 07:40
@taiki-e
Copy link
Member

taiki-e commented Jan 30, 2025

ptr::dangling* has been stabilized in Rust 1.84 (https://doc.rust-lang.org/stable/std/ptr/fn.dangling.html), so I think this lint needs to check MSRV.

@aaron-ang aaron-ang force-pushed the cast-dangling branch 3 times, most recently from 33867dd to d0653d4 Compare February 10, 2025 07:35
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

Looks to be almost there. Just a last set of smaller changes.

@aaron-ang aaron-ang requested a review from Jarcho February 14, 2025 08:06
@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Feb 20, 2025
@aaron-ang
Copy link
Contributor Author

hi @Jarcho, if the changes look good, I will rebase and squash the commits.

@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Feb 21, 2025
@aaron-ang aaron-ang closed this Feb 21, 2025
@aaron-ang aaron-ang reopened this Feb 21, 2025
@Jarcho
Copy link
Contributor

Jarcho commented Feb 24, 2025

@pitaj
Copy link
Contributor

pitaj commented Feb 24, 2025

Please update your PR description to include the new name of this lint.

@aaron-ang aaron-ang changed the title Add new lint dangling_ptr Add new lint manual_dangling_ptr Feb 24, 2025
@aaron-ang aaron-ang force-pushed the cast-dangling branch 4 times, most recently from 8b457a3 to 88e4bf3 Compare February 24, 2025 23:31
@aaron-ang aaron-ang changed the title Add new lint manual_dangling_ptr add manual_dangling_ptr lint Feb 24, 2025
@pitaj
Copy link
Contributor

pitaj commented Feb 25, 2025

I meant the changelog entry in the description, not the title.

@aaron-ang
Copy link
Contributor Author

hi @Jarcho is this ready to be merged?

@aaron-ang aaron-ang force-pushed the cast-dangling branch 2 times, most recently from 3706971 to b166f89 Compare March 14, 2025 23:27
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

Looks to be fine. Thank you.

@Jarcho Jarcho added this pull request to the merge queue Mar 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 22, 2025
@Jarcho
Copy link
Contributor

Jarcho commented Mar 22, 2025

The larger types don't have a consistent alignment on all platforms. I would just avoid using them for tests.

@aaron-ang aaron-ang force-pushed the cast-dangling branch 3 times, most recently from 21207a2 to 4d23351 Compare March 23, 2025 20:44
Comment on lines +1 to +4
#![warn(clippy::manual_dangling_ptr)]
use std::mem;

pub fn foo(_const: *const f32, _mut: *mut i32) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Jarcho I have modified the tests to use at most 32-bit types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

could you add the PR to the merge queue?

@Jarcho Jarcho added this pull request to the merge queue Mar 31, 2025
Merged via the queue into rust-lang:master with commit b46b311 Mar 31, 2025
11 checks passed
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.

Lint casting integers to pointers
5 participants