Skip to content
Open
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: 0 additions & 8 deletions hawk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,6 @@ kind = "enum_variant"
level = "expect"
reason = "external code table: regular-expression flag bits shared with JSC"

[[override]]
lint = "hawk::dead_public"
crate = "bun_jsc"
item = "weak::WeakRefType::PostgreSQLQueryClient"
kind = "enum_variant"
level = "expect"
reason = "external code table: weak-ref type numbering shared with JSC"

[[override]]
lint = "hawk::dead_public"
crate = "bun_runtime"
Expand Down
2 changes: 1 addition & 1 deletion src/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ ASCII literals / `&'static` ASCII tables, bytes already validated as ASCII,
or bytes that really are Latin-1; `utf16(units)`.
`String::to_encoded_slice()` borrows any `String` as one;
`EncodedSlice::to_utf8() -> Utf8Bytes<'a>`; `bun_jsc::EncodedSliceJsc` adds
`to_js`, `to_{,type_,range_,syntax_}error_instance`, `to_json_object`, and
`to_js`, `to_{,syntax_}error_instance`, `to_json_object`, and
`to_external_value` / `external` (hand a globally-allocated buffer to JSC).

Bytes → JS string: `bun_string_jsc::create_utf8_for_js(global, bytes)?`
Expand Down
21 changes: 0 additions & 21 deletions src/bun_core/comptime_string_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,13 @@ pub trait HasLength {
fn length(&self) -> usize;
}

impl HasLength for [u8] {
#[inline]
fn length(&self) -> usize {
self.len()
}
}

impl HasLength for &[u8] {
#[inline]
fn length(&self) -> usize {
self.len()
}
}

impl HasLength for &str {
#[inline]
fn length(&self) -> usize {
self.len()
}
}

impl HasLength for &crate::String {
#[inline]
fn length(&self) -> usize {
crate::String::length(self)
}
}

/// Lookup for large maps, which store their keys as data instead of as an
/// inlined compare tree: keys are sorted by `(len, bytes)` and concatenated
/// into `blob`; `buckets[len]` is `(blob offset, first sorted position)` of
Expand Down
23 changes: 4 additions & 19 deletions src/bun_core_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ pub fn derive_thread_safe_ref_counted(input: TokenStream) -> TokenStream {
// Struct-level attribute:
// #[ref_count(destroy = <path>)] — `unsafe fn(*mut Self)`; default is
// `drop(::bun_core::heap::take(this))`
// #[ref_count(debug_name = "Name")] — overrides `RefCounted::debug_name()`
//
// Field selection follows the shared `find_ref_count_field` rules (a
// `#[ref_count]`-annotated field, else a field literally named `ref_count`).
Expand All @@ -478,13 +477,9 @@ pub fn derive_thread_safe_ref_counted(input: TokenStream) -> TokenStream {
// migrated structs keep their own bespoke `ref_`/`r#ref`/`deref` thin
// wrappers — emitting inherent fns here would collide.

/// Parse the struct-level `#[ref_count(destroy = …, debug_name = "…")]`
/// attribute (both keys optional, either order).
fn parse_ref_count_attrs(
attrs: &[syn::Attribute],
) -> Result<(Option<syn::Expr>, Option<LitStr>), syn::Error> {
/// Parse the struct-level `#[ref_count(destroy = …)]` attribute (optional).
fn parse_ref_count_attrs(attrs: &[syn::Attribute]) -> Result<Option<syn::Expr>, syn::Error> {
let mut destroy = None;
let mut debug_name = None;
for a in attrs {
if !a.path().is_ident("ref_count") {
continue;
Expand All @@ -494,16 +489,13 @@ fn parse_ref_count_attrs(
if meta.path.is_ident("destroy") {
destroy = Some(meta.value()?.parse::<syn::Expr>()?);
Ok(())
} else if meta.path.is_ident("debug_name") {
debug_name = Some(meta.value()?.parse::<LitStr>()?);
Ok(())
} else {
Err(meta.error("unknown ref_count attribute key"))
}
})?;
}
}
Ok((destroy, debug_name))
Ok(destroy)
}

/// `#[derive(RefCounted)]` — see module comment above.
Expand All @@ -526,7 +518,7 @@ pub fn derive_ref_counted(input: TokenStream) -> TokenStream {
Ok(f) => f,
Err(e) => return e.to_compile_error().into(),
};
let (destroy, debug_name) = match parse_ref_count_attrs(&input.attrs) {
let destroy = match parse_ref_count_attrs(&input.attrs) {
Ok(v) => v,
Err(e) => return e.to_compile_error().into(),
};
Expand All @@ -544,16 +536,9 @@ pub fn derive_ref_counted(input: TokenStream) -> TokenStream {
drop(unsafe { ::bun_core::heap::take(this) });
},
};
let debug_name_impl = debug_name.map(|lit| {
quote! {
#[inline]
fn debug_name() -> &'static str { #lit }
}
});

quote! {
impl #impl_g ::bun_ptr::RefCounted for #name #ty_g #where_g {
#debug_name_impl
#[inline]
unsafe fn get_ref_count(this: *mut Self) -> *mut ::bun_ptr::RefCount<Self> {
// SAFETY: caller contract — `this` points to a live Self.
Expand Down
4 changes: 0 additions & 4 deletions src/codegen/replacements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ for (let id = 0; id < jsclasses.length; id++) {

// These rules are run on the entire file, including within strings.
export const globalReplacements: ReplacementRule[] = [
{
from: /\bnotImplementedIssue\(\s*([0-9]+)\s*,\s*((?:"[^"]*"|'[^']+'))\s*\)/g,
toRaw: "__intrinsic__makeTypeError(`${$2} is not implemented yet. See https://github.com/oven-sh/bun/issues/$1`)",
},
{
from: /\bnotImplementedIssueFn\(\s*([0-9]+)\s*,\s*((?:"[^"]*"|'[^']+'))\s*\)/g,
toRaw:
Expand Down
Loading
Loading