Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ multiple_crate_versions = "allow"
future_not_send = "allow"

[workspace.dependencies]
allocator-api2 = { version = "0.2.21", default-features = false, features = ["alloc", "std"] }
anstream = "1.0.0"
anyhow = "1.0.98"
assert2 = "0.4.0"
Expand All @@ -51,7 +50,7 @@ bindgen = "0.72.1"
bitflags = "2.10.0"
brush-parser = "0.4.0"
bstr = { version = "1.12.0", default-features = false, features = ["alloc", "std"] }
bumpalo = { version = "3.17.0", features = ["allocator-api2"] }
bumpalo = { version = "3.17.0", features = ["collections"] }
bytemuck = { version = "1.23.0", features = ["extern_crate_alloc", "must_cast"] }
cc = "1.2.39"
clap = "4.5.53"
Expand Down
1 change: 0 additions & 1 deletion crates/fspy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ license.workspace = true
publish = false

[dependencies]
allocator-api2 = { workspace = true, features = ["alloc"] }
wincode = { workspace = true }
bstr = { workspace = true, default-features = false }
bumpalo = { workspace = true }
Expand Down
5 changes: 2 additions & 3 deletions crates/fspy/src/arena.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use allocator_api2::vec::Vec;
use bumpalo::Bump;
use bumpalo::{Bump, collections::Vec};

use crate::PathAccess;

Expand All @@ -10,7 +9,7 @@ pub struct PathAccessArena {
#[borrows(bump)]
#[covariant]
// TODO(pref): use linked list to avoid realloc & copy. We don't need random access.
pub accesses: Vec<PathAccess<'this>, &'this Bump>,
pub accesses: Vec<'this, PathAccess<'this>>,
}

impl Default for PathAccessArena {
Expand Down
2 changes: 1 addition & 1 deletion crates/fspy_shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ license.workspace = true
publish = false

[dependencies]
allocator-api2 = { workspace = true }
wincode = { workspace = true, features = ["derive"] }
bitflags = { workspace = true }
bumpalo = { workspace = true }
bstr = { workspace = true }
bytemuck = { workspace = true, features = ["must_cast", "derive"] }
native_str = { workspace = true }
Expand Down
9 changes: 3 additions & 6 deletions crates/fspy_shared/src/ipc/native_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
path::{Path, StripPrefixError},
};

use allocator_api2::alloc::Allocator;
use bumpalo::Bump;
use bytemuck::TransparentWrapper;
use native_str::NativeStr;
use wincode::{
Expand Down Expand Up @@ -61,11 +61,8 @@ impl NativePath {
Self::wrap_ref(NativeStr::from_wide(wide))
}

pub fn clone_in<'new_alloc, A>(&self, alloc: &'new_alloc A) -> &'new_alloc Self
where
&'new_alloc A: Allocator,
{
Self::wrap_ref(self.inner.clone_in(alloc))
pub fn clone_in<'bump>(&self, bump: &'bump Bump) -> &'bump Self {
Self::wrap_ref(self.inner.clone_in(bump))
}

pub fn strip_path_prefix<P: AsRef<Path>, R, F: FnOnce(Result<&Path, StripPrefixError>) -> R>(
Expand Down
2 changes: 1 addition & 1 deletion crates/native_str/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
rust-version.workspace = true

[dependencies]
allocator-api2 = { workspace = true }
bumpalo = { workspace = true }
bytemuck = { workspace = true, features = ["must_cast", "derive"] }
wincode = { workspace = true }

Expand Down
13 changes: 3 additions & 10 deletions crates/native_str/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::os::windows::ffi::OsStrExt as _;
use std::os::windows::ffi::OsStringExt as _;
use std::{borrow::Cow, ffi::OsStr, fmt::Debug, mem::MaybeUninit};

use allocator_api2::alloc::Allocator;
use bumpalo::Bump;
#[cfg(windows)]
use bytemuck::must_cast_slice;
use bytemuck::{TransparentWrapper, TransparentWrapperAlloc};
Expand Down Expand Up @@ -87,15 +87,8 @@ impl NativeStr {
return Cow::Borrowed(self.as_os_str());
}

pub fn clone_in<'new_alloc, A>(&self, alloc: &'new_alloc A) -> &'new_alloc Self
where
&'new_alloc A: Allocator,
{
use allocator_api2::vec::Vec;
let mut data = Vec::<u8, _>::with_capacity_in(self.data.len(), alloc);
data.extend_from_slice(&self.data);
let data = data.leak::<'new_alloc>();
Self::wrap_ref(data)
pub fn clone_in<'bump>(&self, bump: &'bump Bump) -> &'bump Self {
Self::wrap_ref(bump.alloc_slice_copy(&self.data))
}
}

Expand Down
Loading