From 56a112fcada6b06ebc85ff8f46865f14a1ca94ec Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 29 Oct 2021 09:43:39 +0200 Subject: [PATCH] Make Id a "fundamental" type (like Box) This changes the coherence rules to give Id less flexibility in terms of forwards compatibility, but in return allowing downstream crates (like objc2_foundation) to implement From for this type. --- objc2/src/lib.rs | 1 + objc2/src/rc/id.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/objc2/src/lib.rs b/objc2/src/lib.rs index e97e6b207..2097187bf 100644 --- a/objc2/src/lib.rs +++ b/objc2/src/lib.rs @@ -65,6 +65,7 @@ The bindings can be used on Linux or *BSD utilizing the )] #![warn(missing_docs)] #![allow(clippy::missing_safety_doc)] +#![feature(fundamental)] // Update in Cargo.toml as well. #![doc(html_root_url = "https://docs.rs/objc2/0.2.7")] diff --git a/objc2/src/rc/id.rs b/objc2/src/rc/id.rs index a2b9f5435..a4d93c47e 100644 --- a/objc2/src/rc/id.rs +++ b/objc2/src/rc/id.rs @@ -92,6 +92,7 @@ use crate::Message; /// let cloned: Id = shared.clone(); /// // Do something with `&T` here /// ``` +#[fundamental] #[repr(transparent)] // TODO: Figure out if `Message` bound on `T` would be better here? // TODO: Add `?Sized + ptr::Thin` bound on `T` to allow for extern types