Skip to content

clippy: fix raw ptr lints#687

Merged
Amanieu merged 5 commits intorust-lang:masterfrom
xtqqczze:clippy/ptr
Feb 27, 2026
Merged

clippy: fix raw ptr lints#687
Amanieu merged 5 commits intorust-lang:masterfrom
xtqqczze:clippy/ptr

Conversation

@xtqqczze
Copy link
Contributor

No description provided.

@clarfonthey
Copy link
Contributor

The &raw const changes, I would say are an improvement, but I'm wary of the casts because hashbrown already has lots of places where we explicitly inline methods like this due to code bloat. Are you sure that isn't the case here?

I'd be in favour of consistency (right now, we have a mix of both), but it would make sense to move toward not doing this instead if that's the case.

@xtqqczze
Copy link
Contributor Author

I haven’t seen any evidence of increased code bloat in the LLVM IR, when I checked on Godbolt (https://godbolt.org/z/PMKPfWWje) the generated code looked the same with and without cast.

@clarfonthey
Copy link
Contributor

Right, the specific instances where code bloat was a concern was due to closures, which isn't a concern here. I think in that case it'd be reasonable to try and include some of the not-default but still useful pointer lints for clippy, to help ensure consistency.

@Amanieu
Copy link
Member

Amanieu commented Feb 27, 2026

In this case there is basically no bloat because the cast is inlined by the MIR inliner before monomorphization. The LLVM IR bloat issue really comes up with things like closure where inlining has to be deferred to post-monomorphization codegen.

@Amanieu Amanieu added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 27, 2026
@Amanieu Amanieu enabled auto-merge February 27, 2026 20:45
@Amanieu Amanieu added this pull request to the merge queue Feb 27, 2026
Merged via the queue into rust-lang:master with commit cb6d629 Feb 27, 2026
25 checks passed
@xtqqczze xtqqczze deleted the clippy/ptr branch February 27, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants