rust/library/core/src/slice
bors 3e7514670d Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se
allow arbitrary inherent impls for builtin types in core

Part of https://github.com/rust-lang/compiler-team/issues/487. Slightly adjusted after some talks with `@m-ou-se` about the requirements of `t-libs-api`.

This adds a crate attribute `#![rustc_coherence_is_core]` which allows arbitrary impls for builtin types in core.

For other library crates impls for builtin types should be avoided if possible. We do have to allow the existing stable impls however. To prevent us from accidentally adding more of these in the future, there is a second attribute `#[rustc_allow_incoherent_impl]` which has to be added to **all impl items**. This only supports impls for builtin types but can easily be extended to additional types in a future PR.

This implementation does not check for overlaps in these impls. Perfectly checking that requires us to check the coherence of these incoherent impls in every crate, as two distinct dependencies may add overlapping methods. It should be easy enough to detect if it goes wrong and the attribute is only intended for use inside of std.

The first two commits are mostly unrelated cleanups.
2022-03-30 12:28:50 +00:00
..
iter cleanup some of the less terrifying library code 2022-03-29 20:18:27 -04:00
ascii.rs Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se 2022-03-30 12:28:50 +00:00
cmp.rs Make [u8]::cmp implementation branchless 2022-02-14 23:16:35 +01:00
index.rs add #[must_use] to functions of slice and its iterators. 2022-03-24 15:21:03 +01:00
iter.rs add #[must_use] to functions of slice and its iterators. 2022-03-24 15:21:03 +01:00
memchr.rs Add #[must_use] to expensive computations 2021-10-12 23:27:17 -04:00
mod.rs remove now unnecessary lang items 2022-03-30 11:23:58 +02:00
raw.rs add #[must_use] to functions of slice and its iterators. 2022-03-24 15:21:03 +01:00
rotate.rs Fix a bunch of typos 2021-12-14 16:40:43 +01:00
sort.rs mark FIXMES for all the places found that are probably offset_from 2022-03-29 20:18:28 -04:00
specialize.rs Remove size_of == 1 case from fill specialization. 2021-08-09 19:25:28 +02:00