Unverified Commit a9b5f9b6 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

chore(turbopack): Fix building local crates with `--all-features` (#80117)

This is a prerequisite for using https://github.com/boshen/cargo-shear, which uses `--all-features`. This also avoids some noise in Rust Analyzer, which also uses `--all-features`.
parent 5325afa6
...@@ -344,7 +344,7 @@ impl StaticSortedFile { ...@@ -344,7 +344,7 @@ impl StaticSortedFile {
bail!( bail!(
"Corrupted file seq:{} block:{} > number of blocks {} (block_offsets: {:x}, \ "Corrupted file seq:{} block:{} > number of blocks {} (block_offsets: {:x}, \
blocks: {:x})", blocks: {:x})",
self.sequence_number, self.meta.sequence_number,
block_index, block_index,
self.meta.block_count, self.meta.block_count,
self.meta.block_offsets_start(), self.meta.block_offsets_start(),
...@@ -357,7 +357,7 @@ impl StaticSortedFile { ...@@ -357,7 +357,7 @@ impl StaticSortedFile {
bail!( bail!(
"Corrupted file seq:{} block:{} block offset locations {} + 4 bytes > file end {} \ "Corrupted file seq:{} block:{} block offset locations {} + 4 bytes > file end {} \
(block_offsets: {:x}, blocks: {:x})", (block_offsets: {:x}, blocks: {:x})",
self.sequence_number, self.meta.sequence_number,
block_index, block_index,
offset, offset,
self.mmap.len(), self.mmap.len(),
...@@ -377,7 +377,7 @@ impl StaticSortedFile { ...@@ -377,7 +377,7 @@ impl StaticSortedFile {
bail!( bail!(
"Corrupted file seq:{} block:{} block {} - {} > file end {} (block_offsets: {:x}, \ "Corrupted file seq:{} block:{} block {} - {} > file end {} (block_offsets: {:x}, \
blocks: {:x})", blocks: {:x})",
self.sequence_number, self.meta.sequence_number,
block_index, block_index,
block_start, block_start,
block_end, block_end,
......
...@@ -2,37 +2,37 @@ ...@@ -2,37 +2,37 @@
use std::{num::NonZeroU8, os::raw::c_void, ptr::NonNull, slice}; use std::{num::NonZeroU8, os::raw::c_void, ptr::NonNull, slice};
#[cfg(feature = "atom_size_128")] use self::raw_types::*;
type RawTaggedValue = u128;
#[cfg(any(
target_pointer_width = "32",
target_pointer_width = "16",
feature = "atom_size_64"
))]
type RawTaggedValue = u64;
#[cfg(not(any(
target_pointer_width = "32",
target_pointer_width = "16",
feature = "atom_size_64",
feature = "atom_size_128"
)))]
type RawTaggedValue = usize;
#[cfg(feature = "atom_size_128")] #[cfg(feature = "atom_size_128")]
type RawTaggedNonZeroValue = std::num::NonZeroU128; mod raw_types {
#[cfg(any( pub type RawTaggedValue = u128;
target_pointer_width = "32", pub type RawTaggedNonZeroValue = std::num::NonZeroU128;
target_pointer_width = "16", }
feature = "atom_size_64"
#[cfg(all(
any(
target_pointer_width = "32",
target_pointer_width = "16",
feature = "atom_size_64"
),
not(feature = "atom_size_128")
))] ))]
type RawTaggedNonZeroValue = std::num::NonZeroU64; mod raw_types {
pub type RawTaggedValue = u64;
pub type RawTaggedNonZeroValue = std::num::NonZeroU64;
}
#[cfg(not(any( #[cfg(not(any(
target_pointer_width = "32", target_pointer_width = "32",
target_pointer_width = "16", target_pointer_width = "16",
feature = "atom_size_64", feature = "atom_size_64",
feature = "atom_size_128" feature = "atom_size_128"
)))] )))]
type RawTaggedNonZeroValue = std::ptr::NonNull<()>; mod raw_types {
pub type RawTaggedValue = usize;
pub type RawTaggedNonZeroValue = std::ptr::NonNull<()>;
}
pub(crate) const MAX_INLINE_LEN: usize = std::mem::size_of::<TaggedValue>() - 1; pub(crate) const MAX_INLINE_LEN: usize = std::mem::size_of::<TaggedValue>() - 1;
...@@ -75,6 +75,7 @@ impl TaggedValue { ...@@ -75,6 +75,7 @@ impl TaggedValue {
pub const fn new_tag(value: NonZeroU8) -> Self { pub const fn new_tag(value: NonZeroU8) -> Self {
let value = value.get() as RawTaggedValue; let value = value.get() as RawTaggedValue;
Self { Self {
#[allow(clippy::transmute_int_to_non_zero)]
value: unsafe { std::mem::transmute(value) }, value: unsafe { std::mem::transmute(value) },
} }
} }
......
...@@ -787,13 +787,13 @@ impl FileSystem for DiskFileSystem { ...@@ -787,13 +787,13 @@ impl FileSystem for DiskFileSystem {
f.flush()?; f.flush()?;
#[cfg(feature = "write_version")] #[cfg(feature = "write_version")]
{ {
let mut full_path = full_path.into_owned(); let mut full_path = full_path.to_owned();
let hash = hash_xxh3_hash64(file); let hash = hash_xxh3_hash64(file);
let ext = full_path.extension(); let ext = full_path.extension();
let ext = if let Some(ext) = ext { let ext = if let Some(ext) = ext {
format!("{:016x}.{}", hash, ext.to_string_lossy()) format!("{:016x}.{}", hash, ext.to_string_lossy())
} else { } else {
format!("{:016x}", hash) format!("{hash:016x}")
}; };
full_path.set_extension(ext); full_path.set_extension(ext);
let mut f = std::fs::File::create(&full_path)?; let mut f = std::fs::File::create(&full_path)?;
......
...@@ -14,4 +14,4 @@ workspace = true ...@@ -14,4 +14,4 @@ workspace = true
[dependencies] [dependencies]
proc-macro2 = { workspace = true } proc-macro2 = { workspace = true }
quote = { workspace = true } quote = { workspace = true }
syn = { workspace = true, features = ["full", "extra-traits"] } syn = { workspace = true, features = ["full", "extra-traits", "visit"] }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment