From 25371ac1416c703a674a472438d73ba6f30879e8 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Mon, 6 Jan 2020 20:36:21 -0700 Subject: [PATCH] We need at least rustc 1.28 to use repr transparent. --- Cargo.toml | 4 ++++ src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 77d29bc..e406e20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,10 @@ categories = ["data-structures", "no-std"] [dependencies] # not even std! +[features] +default = [] +rustc_28 = [] + [badges] appveyor = { repository = "Lokathor/tinyvec" } travis-ci = { repository = "Lokathor/tinyvec" } diff --git a/src/lib.rs b/src/lib.rs index 3ca3e0b..53e675f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ enum Payload { /// A `TinyVec` is like a `Vec`, but it will store up to 8 elements /// "inline" on the stack before transitioning into being a normal `Vec`. #[derive(Debug, Clone)] -#[repr(transparent)] +#[cfg_attr(feature = "rustc_28", repr(transparent))] pub struct TinyVec(Payload); // TODO: impl a better Debug