about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-04 17:07:18 +0000
committerbors <bors@rust-lang.org>2024-02-04 17:07:18 +0000
commit34e4c9fa4a8bb00ada7671cc922d09d4ed6e4834 (patch)
treede478db545d4338960872e081ecbae6f89ddca90 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent9fb41079ca03a68e1ffc63d82643eb0afe68d3a1 (diff)
parenta3baebcb3147773c9673e4ea166e3419201e8b9f (diff)
downloadrust-34e4c9fa4a8bb00ada7671cc922d09d4ed6e4834.tar.gz
rust-34e4c9fa4a8bb00ada7671cc922d09d4ed6e4834.zip
Auto merge of #12087 - marcin-serwin:ref_as_ptr_cast, r=blyxyas
Add new lint: `ref_as_ptr`

Fixes #10130

Added new lint `ref_as_ptr` that checks for conversions from references to pointers and suggests using `std::ptr::from_{ref, mut}` instead.

The name is different than suggested in the issue (`as_ptr_cast`) since there were some other lints with similar names (`ptr_as_ptr`, `borrow_as_ptr`) and I wanted to follow the convention.

Note that this lint conflicts with the `borrow_as_ptr` lint in the sense that it recommends changing `&foo as *const _` to `std::ptr::from_ref(&foo)` instead of `std::ptr::addr_of!(foo)`. Personally, I think the former is more readable and, in contrast to `addr_of` macro, can be also applied to temporaries (cf. #9884).

---

changelog: New lint: [`ref_as_ptr`]
[#12087](https://github.com/rust-lang/rust-clippy/pull/12087)
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions