Skip to content

Commit

Permalink
fix small change in rust's specialization rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmocatta committed Oct 7, 2019
1 parent de127d4 commit 3b1945b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,7 @@ mod serialize {
fn serialize_sized<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Self: Sized,
{
let _ = serializer;
unreachable!()
}
Self: Sized;
#[inline(always)]
fn type_id(&self) -> u64
where
Expand All @@ -260,7 +256,17 @@ mod serialize {
unsafe { intrinsics::type_id::<Self>() }
}
}
impl<T: serde::ser::Serialize + ?Sized> Sealed for T {}
impl<T: serde::ser::Serialize + ?Sized> Sealed for T {
#[inline(always)]
default fn serialize_sized<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Self: Sized,
{
let _ = serializer;
unreachable!()
}
}
impl<T: serde::ser::Serialize> Sealed for T {
#[inline(always)]
fn serialize_sized<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
Expand Down

0 comments on commit 3b1945b

Please sign in to comment.