rust/library/core/src/slice
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
..
iter Get !nonnull metadata consistently in slice iterators, without needing assumes 2023-07-20 11:33:49 -07:00
ascii.rs Const-stabilize is_ascii 2023-09-01 11:02:09 -07:00
cmp.rs Add a new compare_bytes intrinsic instead of calling memcmp directly 2023-08-06 15:47:40 -07:00
index.rs impl SliceIndex<str> for (Bound<usize>, Bound<usize>) 2023-07-31 11:32:40 -07:00
iter.rs Get !nonnull metadata consistently in slice iterators, without needing assumes 2023-07-20 11:33:49 -07:00
memchr.rs fix tidy 2023-04-16 07:27:28 +00:00
mod.rs Add #[rustc_never_returns_null_ptr] to std functions 2023-08-06 00:20:28 +02:00
raw.rs slice::from_raw_parts: mention no-wrap-around condition 2023-06-16 14:56:31 +02:00
rotate.rs Make ZST checks in core/alloc more readable 2022-09-22 23:12:29 -07:00
select.rs Use helper functions for min/max_idx 2023-05-24 19:33:04 +00:00
sort.rs Add Median of Medians fallback to introselect 2023-05-24 00:38:20 +00:00
specialize.rs Remove size_of == 1 case from fill specialization. 2021-08-09 19:25:28 +02:00