diff options
author | Brian Olsen <brian@maven-group.org> | 2024-08-25T11·15+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-08-25T15·05+0000 |
commit | 228bf55646ec60346c46110f616a624429402eeb (patch) | |
tree | 6244b8c888671b3364ad4bb545bf46355084cf91 | |
parent | ced05a2bb6b66d30208520d0791f4fa298c429e2 (diff) |
fix(tvix/nix-compat): Feature flag code only used in async r/8587
When only the wire feature was enabled two methods were unused and so would faild `cargo check --no-default-features --features wire`. This feature flags those two methods on async feature since that is the only place they are used. Change-Id: I6ec18a670e3c6e3ecee8d1417c99f1a5084e0ae7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12346 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: Brian Olsen <me@griff.name> Tested-by: BuildkiteCI
-rw-r--r-- | tvix/nix-compat/src/wire/bytes/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tvix/nix-compat/src/wire/bytes/mod.rs b/tvix/nix-compat/src/wire/bytes/mod.rs index 33c5d7d171b8..74adfb49b6a4 100644 --- a/tvix/nix-compat/src/wire/bytes/mod.rs +++ b/tvix/nix-compat/src/wire/bytes/mod.rs @@ -1,9 +1,12 @@ +#[cfg(feature = "async")] +use std::mem::MaybeUninit; use std::{ io::{Error, ErrorKind}, - mem::MaybeUninit, ops::RangeInclusive, }; -use tokio::io::{self, AsyncReadExt, AsyncWriteExt, ReadBuf}; +#[cfg(feature = "async")] +use tokio::io::ReadBuf; +use tokio::io::{self, AsyncReadExt, AsyncWriteExt}; pub(crate) mod reader; pub use reader::BytesReader; @@ -79,6 +82,7 @@ where Ok(buf) } +#[cfg(feature = "async")] pub(crate) async fn read_bytes_buf<'a, const N: usize, R>( reader: &mut R, buf: &'a mut [MaybeUninit<u8>; N], @@ -132,6 +136,7 @@ where } /// SAFETY: The bytes have to actually be initialized. +#[cfg(feature = "async")] unsafe fn assume_init_bytes(slice: &[MaybeUninit<u8>]) -> &[u8] { &*(slice as *const [MaybeUninit<u8>] as *const [u8]) } |