From 20d3ce0277ce1879d43cddfbd36ce2b00da93e75 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Fri, 5 Oct 2018 14:53:31 -0400 Subject: [PATCH] Fix compiler warning --- src/types/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types/mod.rs b/src/types/mod.rs index 058b229..9809472 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -11,7 +11,7 @@ mod capabilities; pub use self::capabilities::Capabilities; pub struct ZeroCopy { - owned: Box<[u8]>, + _owned: Box<[u8]>, derived: D, } @@ -35,14 +35,14 @@ impl ZeroCopy { // the memory pointed to by `owned` now has a stable address (on the heap). // even if we move the `Box` (i.e., into `ZeroCopy`), a slice to it will remain valid. - let owned = owned.into_boxed_slice(); + let _owned = owned.into_boxed_slice(); // this is the unsafe part -- the implementor of `derive` must be aware that the reference // they are passed is not *really* 'static, but rather the lifetime of `&self`. - let static_owned_ref: &'static [u8] = mem::transmute(&*owned); + let static_owned_ref: &'static [u8] = mem::transmute(&*_owned); Ok(ZeroCopy { - owned, + _owned, derived: derive(static_owned_ref)?, }) }