-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoercePointee
doesn't tightly enforce the restriction to #[repr(transparent)]
-only wrappers, if other proc-macros are involved
#135206
Comments
CoercePointee
doesn't effectively enforce the restriction to #[repr(transparent)]
-only wrappersCoercePointee
doesn't tightly enforce the restriction to #[repr(transparent)]
-only wrappers, if other proc-macros are involved
Hey @steffahn and @BoxyUwU ! Thanks for spotting this! I was thinking the other day. Would it make sense that we enforce the
Apologies ahead for using wrong terms and please don't hesitate to correct me. cc @Darksonn |
My ”dumb idea“ personally here would be: could validation of the |
Checking @compiler-errors In the fix you wanted to make for #135217, are you planning to introduce a new |
I am experimenting the WF trait since this week. I will report back with results. @rustbot claim |
…llformed, r=compiler-errors Introduce CoercePointeeWellformed for coherence checks at typeck stage Fix rust-lang#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. rust-lang#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
…llformed, r=compiler-errors Introduce CoercePointeeWellformed for coherence checks at typeck stage Fix rust-lang#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. rust-lang#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
Rollup merge of rust-lang#136107 - dingxiangfei2009:coerce-pointee-wellformed, r=compiler-errors Introduce CoercePointeeWellformed for coherence checks at typeck stage Fix rust-lang#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. rust-lang#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
…llformed, r=compiler-errors Introduce CoercePointeeWellformed for coherence checks at typeck stage Fix rust-lang#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. rust-lang#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
…llformed, r=compiler-errors Introduce CoercePointeeWellformed for coherence checks at typeck stage Fix rust-lang#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. rust-lang#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
Define a proc macro that strips the
#[repr(transparent)]
.use it
compiles successfully, expands to
As far as I understand the RFC and intent, the intended stabilization should only stabilize allowing these (
CoerceUnsized
&DispatchFromDyn
impls) to be generated for#[repr(transparent)]
types.@rustbot label F-derive_coerce_pointee
The text was updated successfully, but these errors were encountered: