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
4 changes: 0 additions & 4 deletions scripts/build/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ export interface Config {
freebsd: boolean;
/** linux || darwin || freebsd */
unix: boolean;
/** darwin || freebsd — kqueue-based event loop */
kqueue: boolean;
x64: boolean;
arm64: boolean;

Expand Down Expand Up @@ -740,7 +738,6 @@ export function resolveConfig(partial: PartialConfig, toolchain: Toolchain): Con
const windows = os === "windows";
const freebsd = os === "freebsd";
const unix = linux || darwin || freebsd;
const kqueue = darwin || freebsd;
const x64 = arch === "x64";
const arm64 = arch === "aarch64";
// Darwin target on a non-darwin host (Linux CI box building macOS
Expand Down Expand Up @@ -1183,7 +1180,6 @@ export function resolveConfig(partial: PartialConfig, toolchain: Toolchain): Con
windows,
freebsd,
unix,
kqueue,
x64,
arm64,
host,
Expand Down
3 changes: 0 additions & 3 deletions scripts/build/depVersionsHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ export function generateDepVersionsHeader(cfg: Config): string {
'extern "C" {',
"#endif",
"",
"// Dependency versions",
...versions.map(([name, val]) => `#define BUN_DEP_${name} "${val}"`),
"",
"// C string constants for easy access",
...versions.map(([name, val]) => `static const char* const BUN_VERSION_${name} = "${val}";`),
"",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export interface Dependency {

/**
* Macro name suffix for `bun_dependency_versions.h` — becomes
* `BUN_DEP_<macro>` / `BUN_VERSION_<macro>`. The value is derived from
* `BUN_VERSION_<macro>`. The value is derived from
* `source(cfg)`: `github-archive.commit`, `prebuilt.identity`, etc.
*
* Omit for deps that shouldn't appear in `process.versions` (e.g.
Expand Down
1 change: 0 additions & 1 deletion scripts/glob-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ const patterns = {
"packages/bun-usockets/src/crypto/*.c",
"src/jsc/bindings/uv-posix-polyfills.c",
"src/jsc/bindings/uv-posix-stubs.c",
"src/*.c",
"src/jsc/bindings/node/http/llhttp/*.c",
],
},
Expand Down
8 changes: 0 additions & 8 deletions src/ast/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,6 @@ impl Map {
})
}

pub fn init(source_count: usize) -> Map {
let mut v: NestedList = Vec::with_capacity(source_count);
v.resize_with(source_count, Vec::new);
Map {
symbols_for_source: v,
}
}

// Takes ownership of `list` and boxes it into a one-element NestedList.
// PERF: one extra allocation — profile if needed (single caller is the
// printer one-shot, cold).
Expand Down
8 changes: 0 additions & 8 deletions src/boringssl_sys/boringssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ impl GeneralNames {
unsafe { sk_num(self.0.as_ptr().cast::<OPENSSL_STACK>()) }
}

pub fn is_empty(&self) -> bool {
self.len() == 0
}

/// Borrows the `i`th entry; `None` past the end.
pub(crate) fn get(&self, i: usize) -> Option<&GENERAL_NAME> {
if i >= self.len() {
Expand Down Expand Up @@ -1098,10 +1094,6 @@ opaque!(

/// `TLS1_3_VERSION` (`openssl/tls1.h`).
pub const TLS1_3_VERSION: u16 = 0x0304;
/// `X509_V_OK` (`openssl/x509.h`).
pub const X509_V_OK: c_long = 0;
/// `SSL_SESS_CACHE_CLIENT` (`openssl/ssl.h`).
pub const SSL_SESS_CACHE_CLIENT: c_int = 1;

unsafe extern "C" {
pub safe fn TLS_method() -> *const SSL_METHOD;
Expand Down
29 changes: 3 additions & 26 deletions src/bun_alloc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,6 @@ impl Default for Mutex {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct AllocError;

impl AllocError {
#[inline]
pub const fn name(self) -> &'static str {
"OutOfMemory"
}
}

impl core::fmt::Display for AllocError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("OutOfMemory")
Expand Down Expand Up @@ -698,13 +691,6 @@ pub unsafe fn realloc_raw(
Ok(new_ptr.cast::<u8>())
}

/// `mi_usable_size` — actual allocated size for a mimalloc-owned ptr.
#[inline]
pub fn usable_size(ptr: *const u8) -> usize {
// SAFETY: `mi_usable_size` is null-safe (returns 0).
unsafe { mimalloc::mi_usable_size(ptr.cast()) }
}

// ──────────────────────────────────────────────────────────────────────────
// Symbols hoisted DOWN into T0 so higher tiers can re-import without cycles.
// ──────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -1453,7 +1439,7 @@ macro_rules! bss_singleton {

/// Heap-allocate a fresh `T` via mimalloc and run its in-place `init_at` initializer.
///
/// Shared body of the `BSSList`/`BSSStringList`/`BSSMapInner` `init()` shims.
/// Shared body of the `BSSStringList`/`BSSMapInner` `init()` shims.
/// The once-guard is the *caller's* responsibility; use the `bss_*!` macros
/// for the canonical per-monomorphization singleton.
#[doc(hidden)] // Public only for the `bss_singleton!` macro expansion in dependent crates.
Expand Down Expand Up @@ -2020,9 +2006,7 @@ impl<ValueType, const COUNT: usize> BSSList<ValueType, COUNT> {
// Rust cannot define generic statics, so the per-monomorphization storage is
// emitted at the *declare site* via `bss_list! { name: T, N }` (see macro
// below), which owns a `SyncUnsafeCell<MaybeUninit<Self>>` + `Once` and
// calls `init_at` on first access. `init()` is kept for callers that manage
// their own once-guard (e.g. `dir_info::hash_map_instance`); it heap-allocs
// a fresh instance each call.
// calls `init_at` on first access.

/// In-place field initialization into demand-zero storage.
///
Expand All @@ -2048,13 +2032,6 @@ impl<ValueType, const COUNT: usize> BSSList<ValueType, COUNT> {
}
}

/// Heap-allocate and initialize a fresh instance. The once-guard is the
/// *caller's* responsibility — use `bss_list!` for
/// the canonical per-monomorphization singleton.
pub fn init() -> NonNull<Self> {
bss_heap_init(Self::init_at)
}

// Singleton teardown belongs to the `bss_list!` singleton wrapper;
// Drop only frees the heap-allocated head chain.

Expand All @@ -2066,7 +2043,7 @@ impl<ValueType, const COUNT: usize> BSSList<ValueType, COUNT> {
&mut self,
) -> core::result::Result<*mut MaybeUninit<ValueType>, AllocError> {
self.used += 1;
// SAFETY: head is always non-null after init() (points at self.tail or heap block).
// SAFETY: head is always non-null after init_at() (points at self.tail or heap block).
let mut head_ptr = self.head.unwrap();
// Check capacity first, allocate the new block if
// needed, then reserve exactly one slot. Safe under `self.mutex`.
Expand Down
8 changes: 0 additions & 8 deletions src/bun_core/bounded_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,6 @@ impl<T, const BUFFER_CAPACITY: usize> BoundedArrayAligned<T, BUFFER_CAPACITY> {
// If a non-`Copy` caller
// appears, add a `from_slice_clone` or use `ptr::copy_nonoverlapping`.

/// Return the element at index `i` of the slice.
pub fn get(&self, i: usize) -> T
where
T: Copy,
{
self.const_slice()[i]
}

/// Check that the slice can hold at least `additional_count` items.
pub(crate) fn ensure_unused_capacity(
&self,
Expand Down
17 changes: 0 additions & 17 deletions src/bun_core/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3354,14 +3354,6 @@ impl OutOfRangeValue for i64 {
"i64"
}
}
impl OutOfRangeValue for i32 {
fn write_received(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, " Received {}", self)
}
fn type_name() -> &'static str {
"i32"
}
}
impl<'a> OutOfRangeValue for &'a [u8] {
fn write_received(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, " Received {}", bstr::BStr::new(self))
Expand All @@ -3370,15 +3362,6 @@ impl<'a> OutOfRangeValue for &'a [u8] {
"[]const u8"
}
}
// MOVE_DOWN: bun_core::String → bun_alloc (T0). Re-import from there.
impl OutOfRangeValue for bun_alloc::String {
fn write_received(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, " Received {}", self)
}
fn type_name() -> &'static str {
"bun.String"
}
}

pub struct NewOutOfRangeFormatter<'a, T: OutOfRangeValue> {
pub value: T,
Expand Down
7 changes: 0 additions & 7 deletions src/bun_core/string/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,6 @@ impl<'a> SplitIterator<'a> {

Some(&self.buffer[start..end])
}

/// Returns a slice of the remaining bytes. Does not affect iterator state.
pub fn rest(&self) -> &'a [u8] {
let end = self.buffer.len();
let start = self.index.unwrap_or(end);
&self.buffer[start..end]
}
}

impl<'a> Iterator for SplitIterator<'a> {
Expand Down
11 changes: 0 additions & 11 deletions src/bun_core/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1835,17 +1835,6 @@ impl SliceWithUnderlyingString {
}
}

/// `fromUTF8` — wrap a borrowed UTF-8 slice (caller keeps it alive).
#[inline]
pub fn from_utf8(utf8: &[u8]) -> SliceWithUnderlyingString {
SliceWithUnderlyingString {
utf8: ZigStringSlice::from_utf8_never_free(utf8),
underlying: String::DEAD,
#[cfg(debug_assertions)]
did_report_extra_memory_debug: false,
}
}

/// `slice` — the UTF-8 byte view.
#[inline]
pub fn slice(&self) -> &[u8] {
Expand Down
3 changes: 0 additions & 3 deletions src/bun_core/string/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@
//! (`FixedBufferStream`, `BufWriter`, `FmtAdapter`, `DiscardingWriter`) on top,
//! so the existing `bun_io::Write` importers are unaffected.

/// `Result<T>` over `core::fmt::Error` so `?` composes everywhere.
pub type Result<T = ()> = core::result::Result<T, core::fmt::Error>;

pub use crate::io::{IntLe, Write};
2 changes: 1 addition & 1 deletion src/bun_core/windows_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn GetStdHandle(std_handle: DWORD) -> Option<HANDLE> {
// `crate::windows_sys::*` path used by callers.
// ──────────────────────────────────────────────────────────────────────────
pub use bun_windows_sys::{
CURDIR, Curdir, PEB, PebView, ProcessParameters, RTL_USER_PROCESS_PARAMETERS, TEB, peb, teb,
CURDIR, PEB, ProcessParameters, RTL_USER_PROCESS_PARAMETERS, TEB, peb, teb,
};

// SAFETY: nested `i16`/`u16` POD; all-zero is the documented pre-call state
Expand Down
6 changes: 0 additions & 6 deletions src/cares_sys/c_ares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,6 @@ pub struct AddrInfo_hints {
// SAFETY: four `c_int` fields; all-zero is a valid hints value (S021).
unsafe impl bun_core::ffi::Zeroable for AddrInfo_hints {}

impl AddrInfo_hints {
pub fn is_empty(&self) -> bool {
self.ai_flags == 0 && self.ai_family == 0 && self.ai_socktype == 0 && self.ai_protocol == 0
}
}

#[derive(Copy, Clone, Default)]
pub struct ChannelOptions {
pub timeout: Option<i32>,
Expand Down
9 changes: 0 additions & 9 deletions src/clap/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ pub enum Error {
MissingValue,
#[error("InvalidArgument")]
InvalidArgument,
#[error("WriteFailed")]
WriteFailed,
}

impl Error {
Expand All @@ -17,7 +15,6 @@ impl Error {
Self::DoesntTakeValue => "DoesntTakeValue",
Self::MissingValue => "MissingValue",
Self::InvalidArgument => "InvalidArgument",
Self::WriteFailed => "WriteFailed",
}
}
}
Expand All @@ -28,12 +25,6 @@ impl bun_core::output::ErrName for Error {
}
}

impl From<core::fmt::Error> for Error {
fn from(_: core::fmt::Error) -> Self {
Self::WriteFailed
}
}

impl From<crate::streaming::ArgError> for Error {
fn from(e: crate::streaming::ArgError) -> Self {
match e {
Expand Down
5 changes: 0 additions & 5 deletions src/clap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ impl Diagnostic {
crate::Error::InvalidArgument => {
bun_core::pretty_errorln!("<red>error<r><d>:<r> Invalid Argument '{}'", name)
}
_ => bun_core::pretty_errorln!(
"<red>error<r><d>:<r> {} while parsing argument '{}'",
err,
name
),
}
bun_core::Output::flush();
Ok(())
Expand Down
1 change: 0 additions & 1 deletion src/codegen/generate-js2native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const rustIdentifierPaths: Record<string, string> = {
"collections/linear_fifo.rs": "collections/linear_fifo.rs",
"crash_handler.rs": "crash_handler/crash_handler.rs",
"css_internals.rs": "css_jsc/css_internals.rs",
"dependency.rs": "install/dependency.rs",
"escapeRegExp.rs": "string/escapeRegExp.rs",
"event_loop.rs": "jsc/event_loop.rs",
"ffi.rs": "runtime/ffi/ffi.rs",
Expand Down
Loading
Loading