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 {
bail!(
"Corrupted file seq:{} block:{} > number of blocks {} (block_offsets: {:x}, \
blocks: {:x})",
self.sequence_number,
self.meta.sequence_number,
block_index,
self.meta.block_count,
self.meta.block_offsets_start(),
......@@ -357,7 +357,7 @@ impl StaticSortedFile {
bail!(
"Corrupted file seq:{} block:{} block offset locations {} + 4 bytes > file end {} \
(block_offsets: {:x}, blocks: {:x})",
self.sequence_number,
self.meta.sequence_number,
block_index,
offset,
self.mmap.len(),
......@@ -377,7 +377,7 @@ impl StaticSortedFile {
bail!(
"Corrupted file seq:{} block:{} block {} - {} > file end {} (block_offsets: {:x}, \
blocks: {:x})",
self.sequence_number,
self.meta.sequence_number,
block_index,
block_start,
block_end,
......
......@@ -2,37 +2,37 @@
use std::{num::NonZeroU8, os::raw::c_void, ptr::NonNull, slice};
#[cfg(feature = "atom_size_128")]
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;
use self::raw_types::*;
#[cfg(feature = "atom_size_128")]
type RawTaggedNonZeroValue = std::num::NonZeroU128;
#[cfg(any(
target_pointer_width = "32",
target_pointer_width = "16",
feature = "atom_size_64"
mod raw_types {
pub type RawTaggedValue = u128;
pub type RawTaggedNonZeroValue = std::num::NonZeroU128;
}
#[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(
target_pointer_width = "32",
target_pointer_width = "16",
feature = "atom_size_64",
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;
......@@ -75,6 +75,7 @@ impl TaggedValue {
pub const fn new_tag(value: NonZeroU8) -> Self {
let value = value.get() as RawTaggedValue;
Self {
#[allow(clippy::transmute_int_to_non_zero)]
value: unsafe { std::mem::transmute(value) },
}
}
......
......@@ -787,13 +787,13 @@ impl FileSystem for DiskFileSystem {
f.flush()?;
#[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 ext = full_path.extension();
let ext = if let Some(ext) = ext {
format!("{:016x}.{}", hash, ext.to_string_lossy())
} else {
format!("{:016x}", hash)
format!("{hash:016x}")
};
full_path.set_extension(ext);
let mut f = std::fs::File::create(&full_path)?;
......
......@@ -14,4 +14,4 @@ workspace = true
[dependencies]
proc-macro2 = { 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