rust/library/core/src/ptr
bors 635c4a5e61 Auto merge of #114494 - est31:extend_useless_ptr_null_checks, r=jackh726
Make useless_ptr_null_checks smarter about some std functions

This teaches the `useless_ptr_null_checks` lint that some std functions can't ever return null pointers, because they need to point to valid data, get references as input, etc.

This is achieved by introducing an `#[rustc_never_returns_null_ptr]` attribute and adding it to these std functions (gated behind bootstrap `cfg_attr`).

Later on, the attribute could maybe be used to tell LLVM that the returned pointer is never null. I don't expect much impact of that though, as the functions are pretty shallow and usually the input data is already never null.

Follow-up of PR #113657

Fixes #114442
2023-09-16 03:40:20 +00:00
..
alignment.rs rm const traits in libcore 2023-04-16 06:49:27 +00:00
const_ptr.rs Add diagnostic items for <*const _>::cast and <*mut _>::cast_const 2023-08-15 10:14:41 +02:00
metadata.rs Flip cfg's for bootstrap bump 2023-07-12 21:38:55 -04:00
mod.rs Auto merge of #114494 - est31:extend_useless_ptr_null_checks, r=jackh726 2023-09-16 03:40:20 +00:00
mut_ptr.rs Fix intra-doc links from pointer appearing in windows HANDLE type alias 2023-08-24 21:36:38 -07:00
non_null.rs Auto merge of #114494 - est31:extend_useless_ptr_null_checks, r=jackh726 2023-09-16 03:40:20 +00:00
unique.rs Flip cfg's for bootstrap bump 2023-07-12 21:38:55 -04:00