rust/library/core
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
..
benches Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se 2022-03-30 12:28:50 +00:00
tests Debug print char 0 as '\0' rather than '\u{0}' 2022-03-27 04:49:10 -07:00
Cargo.toml Build libcore as 2021 in a few more places 2022-02-06 15:41:01 -08:00