rust/compiler/rustc_hir/src
Matthias Krüger af3c51d849
Rollup merge of #136107 - dingxiangfei2009:coerce-pointee-wellformed, r=compiler-errors
Introduce CoercePointeeWellformed for coherence checks at typeck stage

Fix #135206

This is the first PR to introduce the "wellformedness" check for `derive(CoercePointee)`.

This patch introduces a new error code to cover all the prerequisites of the said macro. The checks that is enforced with this patch is whether the data is indeed `struct` and whether the layout is set to `repr(transparent)`.

A following series of patch will arrive later to address the following concern.
1. #135217 so that we would only admit one single coercion on one type parameter, and leave the rest for future consideration in tandem of development of other coercion rules.
1. Enforcement of data field requirements.

**An open question** is whether there is a good schema to encode the `#[pointee]` as well, so that we could also check if the `#[pointee]` type parameter is indeed `?Sized`.

``@rustbot`` label F-derive_coerce_pointee
2025-02-11 02:53:42 +01:00
..
hir Bless and add tests 2025-01-23 06:01:36 +00:00
arena.rs Add hir::Attribute 2024-12-15 19:18:46 +01:00
def_path_hash_map.rs Do not store stable crate id in on-disk hash map. 2023-12-24 17:22:48 +00:00
def.rs Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
definitions.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
diagnostic_items.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
hir_id.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
hir.rs Rustfmt 2025-02-08 22:12:13 +00:00
intravisit.rs Uniformly handle HIR literals in visitors and lints 2025-02-05 11:28:24 +00:00
lang_items.rs rename the trait to validity and place a feature gate afront 2025-02-09 20:40:42 +08:00
lib.rs rustc_hir: use box patterns to flatten some nested pattern matches 2025-01-28 22:22:26 +00:00
pat_util.rs Eliminate PatKind::Path 2025-01-29 15:45:13 +00:00
stable_hash_impls.rs Add hir::Attribute 2024-12-15 19:18:46 +01:00
target.rs turn hir::ItemKind::Fn into a named-field variant 2025-01-04 11:35:31 +01:00
tests.rs update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
weak_lang_items.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00