rust/library
Matthias Krüger fbed195b4d
Rollup merge of #133226 - compiler-errors:opt-in-pointer-like, r=lcnr
Make `PointerLike` opt-in instead of built-in

The `PointerLike` trait currently is a built-in trait that computes the layout of the type. This is a bit problematic, because types implement this trait automatically. Since this can be broken due to semver-compatible changes to a type's layout, this is undesirable. Also, calling `layout_of` in the trait system also causes cycles.

This PR makes the trait implemented via regular impls, and adds additional validation on top to make sure that those impls are valid. This could eventually be `derive()`d for custom smart pointers, and we can trust *that* as a semver promise rather than risking library authors accidentally breaking it.

On the other hand, we may never expose `PointerLike`, but at least now the implementation doesn't invoke `layout_of` which could cause ICEs or cause cycles.

Right now for a `PointerLike` impl to be valid, it must be an ADT that is `repr(transparent)` and the non-1zst field needs to implement `PointerLike`. There are also some primitive impls for `&T`/ `&mut T`/`*const T`/`*mut T`/`Box<T>`.
2024-11-20 20:10:13 +01:00
..
alloc Make PointerLike opt-in as a trait 2024-11-20 16:36:12 +00:00
backtrace@230570f2da Try latest backtrace 2024-08-29 12:13:19 -07:00
core Rollup merge of #133226 - compiler-errors:opt-in-pointer-like, r=lcnr 2024-11-20 20:10:13 +01:00
panic_abort step cfg(bootstrap) 2024-07-28 14:46:29 -04:00
panic_unwind move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
portable-simd move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
proc_macro Add a new trait proc_macro::ToTokens 2024-10-27 03:17:05 +01:00
profiler_builtins Run cargo update and update licenses 2024-11-13 12:22:10 +00:00
rtstartup Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
rustc-std-workspace-alloc
rustc-std-workspace-core update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustc-std-workspace-std
std Rollup merge of #130800 - bjoernager:const-mut-cursor, r=joshtriplett 2024-11-20 20:10:12 +01:00
stdarch@e5e00aab0a Bump stdarch to the latest master 2024-11-18 18:52:27 +01:00
sysroot Make profiler_builtins an optional dependency of sysroot, not std 2024-10-17 22:08:36 +11:00
test Update thread spawn hooks. 2024-11-19 18:54:20 +01:00
unwind move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
windows_targets Win: Add dbghelp to the list of import libraries 2024-09-06 21:21:49 +00:00
Cargo.lock Run cargo update and update licenses 2024-11-13 12:22:10 +00:00
Cargo.toml Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu 2024-09-02 00:58:50 +00:00