From 7260481d77b86df301597702329b38e0998fe0bc Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 29 Jan 2025 06:15:56 +0800 Subject: [PATCH] rename the trait to validity and place a feature gate afront --- core/src/marker.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/src/marker.rs b/core/src/marker.rs index 62f569d37df02..163c80ffe1d1f 100644 --- a/core/src/marker.rs +++ b/core/src/marker.rs @@ -1284,14 +1284,23 @@ pub trait FnPtr: Copy + Clone { /// } /// ``` #[rustc_builtin_macro(CoercePointee, attributes(pointee))] -#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize)] +#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize, coerce_pointee_validated)] #[unstable(feature = "derive_coerce_pointee", issue = "123430")] pub macro CoercePointee($item:item) { /* compiler built-in */ } +/// A validation trait that is implemented on data with `derive(CoercePointee)` +/// so that the compiler can enforce a set of rules that the target data must +/// conform to in order for the derived behaviours are safe and useful for +/// the purpose of the said macro. +/// +/// This trait will not ever be exposed for use as public part of the library +/// and shall not ever be stabilised. #[cfg(not(bootstrap))] -#[lang = "coerce_pointee_wellformed"] -#[unstable(feature = "derive_coerce_pointee", issue = "123430")] +#[lang = "coerce_pointee_validated"] +#[unstable(feature = "coerce_pointee_validated", issue = "123430")] #[doc(hidden)] -pub trait CoercePointeeWellformed {} +pub trait CoercePointeeValidated { + /* compiler built-in */ +}