rust/library/core/src/str
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
..
converts.rs Add invalid_from_utf8 analogous to invalid_from_utf8_unchecked 2023-05-27 00:18:28 +02:00
count.rs Make some usize-typed masks definition agnostic to the size of usize 2022-04-15 17:04:59 +02:00
error.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
iter.rs Clarify logic on bytes:code units ratio 2023-07-21 23:49:31 +02:00
lossy.rs Expose Utf8Lossy as Utf8Chunks 2022-08-20 12:49:20 -04:00
mod.rs Auto merge of #114494 - est31:extend_useless_ptr_null_checks, r=jackh726 2023-09-16 03:40:20 +00:00
pattern.rs Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
traits.rs Replace version placeholders with 1.73.0 2023-08-22 06:57:00 -04:00
validations.rs Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00