Repository navigation
Delete src/ptr/owned.rs - #34763
Delete src/ptr/owned.rs#34763
Conversation
The type aliases (Owned, OwnedIn, Dynamic, DynamicOwned, Unmanaged) were all trivial aliases for Box<T> with no callers. The helper functions alloc_slice, from_raw, and into_raw were likewise unused. The only live export was alloc_dupe_slice (== Box::<[T]>::from), used in two files: - s3_signing/credentials.rs: replaced with .clone() on the Box<[u8]> fields - test_runner/diff/diff_match_patch.rs: inlined as a local helper Also drops the dead Owned/OwnedIn/DynamicOwned aliases from ptr/lib.rs and updates stale doc references in bun_alloc.
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
Comment |
|
No test added: this is a dead-code deletion with no observable behavior change.
|
There was a problem hiding this comment.
LGTM — mechanical removal of dead Box<T> aliases and their porting-notes file.
What was reviewed:
- Grepped
src/for remaining references tobun_ptr::owned,Owned/OwnedIn/DynamicOwned,alloc_dupe_slice, and the other deleted helpers — none remain (the onebun.ptr.OwnedInhit inshared.rsis a historical Zig doc-comment, not a type reference). credentials.rs: fields areBox<[u8]>, soself.field.clone()is byte-for-byte equivalent to the olddupe_slice(&self.field).diff_match_patch.rs: localfn dupeis identical to the deletedalloc_dupe_slicebody.
Extended reasoning...
Overview
Deletes src/ptr/owned.rs (~260 lines of Zig→Rust mapping comments plus four trivial helper wrappers) and the Owned<T> / OwnedIn<T> / DynamicOwned<T> re-export aliases from src/ptr/lib.rs. All were = Box<T> type aliases left over from the porting pass. Two callers of the one live helper (alloc_dupe_slice) are updated in place, and two stale doc-comments in bun_alloc are refreshed. Net −281 lines.
Security risks
None. No runtime behavior changes — the two updated call sites produce identical machine code (Box<[u8]>::clone() and Box::<[T]>::from(s) are exactly what the deleted wrapper did). The touched files (S3 signing credentials, test-runner diff) are not affected semantically; only how a boxed slice is duplicated is spelled.
Level of scrutiny
Low. This is dead-code deletion plus two mechanical, provably-equivalent substitutions:
dupe_slice(&self.field)wherefield: Box<[u8]>→self.field.clone().impl<T: Clone> Clone for Box<[T]>allocates and copies exactly likeBox::<[T]>::from(&*b).- The imported
alloc_dupe_slice as dupe→ a localfn dupe<T: Clone>(s: &[T]) -> Box<[T]> { Box::<[T]>::from(s) }with the identical body.
I grepped the whole src/ tree for any remaining references to the deleted module, type aliases, or helper functions and found none beyond a historical Zig-name doc-comment in shared.rs (which is unaffected).
Other factors
The PR description accurately describes the change. The module comment in ptr/lib.rs already flagged owned as "OBSOLETE per PORTING.md §Pointers … kept for diff-pass only", so this is the intended cleanup. No prior reviewer comments to address; no test changes needed since no behavior changes.
Follow-up to #34763. Removes Zig-port scaffolding that had zero callers across the workspace (verified by `rg` per item). ### Whole files deleted | File | Contents | Callers | |---|---|---| | `src/ptr/shared.rs` | `Shared<T>=Rc<T>`, `Weak<T>=rc::Weak<T>` + ~100 lines of mapping comments | 0 | | `src/bun_alloc/maybe_owned.rs` | `MaybeOwned<A>` struct wrapping `Option<A>` | 0 | | `src/bun_alloc/BufferFallbackAllocator.rs` | vtable over FixedBufferAllocator + heap fallback | 0 | | `src/bun_alloc/fallback.rs` + `fallback/z.rs` | libc-malloc `CAllocator` + zeroing wrapper; duplicates `basic.rs` | 0 | | `src/bun_alloc/memory.rs` | `rebase_slice()` | 0 | ### Dead code removed from existing files - `bun_alloc/lib.rs`: `FixedBufferAllocator` (only caller was `BufferFallbackAllocator`, deleted above) - `bun_ptr/lib.rs`: `pub use std::borrow::Cow` + `CowSlice`/`CowSliceZ`/`CowString` type aliases; `TaggedPointerUnion` long-name alias - `bun_collections/array_list.rs` + `lib.rs`: `ArrayList`/`ArrayListIn`/`ArrayListAligned`/`ArrayListAlignedDefault` (all aliased to the same struct; `ArrayListDefault` kept, 1 caller) - `bun_threading/lib.rs`: `pub use std::sync::Once` - `bun_core/util.rs`: `Guarded<T> = Mutex<T>` - `bun_core/deprecated.rs`: `DoublyLinkedList`/`DoublyLinkedNode` (~230 lines + unit tests, zero callers) ### Callers updated - `runtime/jsc_hooks.rs` (2 sites): `bun_ptr::Cow::Borrowed` → `std::borrow::Cow::Borrowed` - `runtime/api/bun/subprocess/Readable.rs`, `runtime/cli/pack_command.rs`: stale comment refs to deleted `bun_ptr::CowString` alias removed ### Verification - `bun bd` builds - `bun run rust:check-all` passes on all 10 targets (linux/macos/windows/freebsd/android × x64/aarch64) Net: +14 / -1027.
Follow-up to #34763 and #34767. Third pass removing zero-caller `pub type` / `pub use` aliases left over from the Zig port, this time reaching into mid-tier crates (jsc, http, io, install, ast, bundler, runtime) in addition to the foundation tier. ### Zero-caller aliases deleted | Crate | Items | |---|---| | `bun_alloc` | `VTable`, `Bump`, `IndexMapManaged` | | `bun_ptr` | `IntrusiveArc`, `weak_ptr::Data` | | `bun_collections` | `StaticBitSet` | | `bun_threading` | `guarded::Debug`, `DebugGuarded` | | `bun_core` | `util::PollFlag`, `output::LogFunction`, `wtf::{RefPtr, StringImpl}`, `windows_sys::{UnicodeString, kernel32 as c}`, `deprecated::RapidHash` re-export + SinglyLinkedList tombstone comment | | `bun_jsc` | `IntegerRangeOptions`, `ErrorableZigString`, `ErrorableJSValue` | | `bun_http` | `H2`, `new_http_context`, `HttpContext`, `HttpThread`, `http_client_result` | | `bun_io` | `EventLoopKind`, `PipeReader` | | `bun_install` | `lockfile::{SerializerLoadResult, ScriptsListKind}` | | `bun_ast` | `ExprInit` | | `bun_bundler` | `GraphStruct`, `Cache` | | `bun_runtime` | `valkey_jsc::valkey_body`, `test_runner::HookKind`, orphaned comment in JSTranspiler.rs | ### Caller rewrites (1 call site each) - `runtime/allocators/LinuxMemFdAllocator.rs`: `bun_ptr::IntrusiveArc` → `bun_ptr::RefPtr` (IntrusiveArc was a type alias for RefPtr) - `bun_core/util.rs`: `crate::deprecated::RapidHash` → `bun_hash::RapidHash` (direct path to canonical impl) ### Stale comment refs updated - `url/lib.rs`: StaticBitSet → IntegerBitSet - `runtime/socket/Listener.rs`: PipeReader → BufferedReader - `runtime/allocators/LinuxMemFdAllocator.rs`: IntrusiveArc → RefPtr ### Verification - `bun bd` builds - `bun run rust:check-all` passes on all 10 targets Net: +13 / -110. No test added: every deleted item had zero callers (verified by workspace-wide `rg` per item); the two rewrites are to the type the alias already resolved to. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…#34806) Follow-up to #34763, #34767, #34778. ### bumpalo dependency removed `bumpalo` is dropped from the workspace root and 10 member crates (ast, base64, bundler, css, js_parser, js_printer, parsers, resolver, shell_parser, sourcemap). The last code-level use was the `pub type Bump = bumpalo::Bump` alias deleted in #34778; every remaining `bumpalo` reference in `src/` is in a comment (verified: `rg 'bumpalo' --type rust src/ | grep -v '//'` returns nothing). ### TaggedPointer → TaggedPtr The long-name `TaggedPointer` alias existed in both `bun_ptr` and `bun_collections`, both resolving to `tagged_pointer::TaggedPtr`. Rewrote the 5 call sites to use `TaggedPtr` directly and replaced both aliases with plain re-exports of the canonical name: - `io/posix_event_loop.rs` (3 sites, via `bun_collections::`) - `runtime/server/mod.rs`, `runtime/server/NodeHTTPResponse.rs` (2 sites, via `bun_ptr::`) ### Duplicate/compat aliases consolidated - `bun_ast::ToSourceOpts` → `ToSourceOptions` (1 caller in `ini/lib.rs`) - `bundler::options::OutputValue` → `OutputFileValue` (2 callers in `StandaloneModuleGraph.rs`; both names aliased the same `output_file::Value` on adjacent lines) ### Verification - `bun bd` builds - `bun run rust:check-all` passes on all 10 targets Net: +11 / -39 (including Cargo.lock regen). No test added: bumpalo was already unreferenced in code (dead dep removal has no fail-before state); the alias rewrites are identity substitutions to the type each alias already resolved to.
Deletes
src/ptr/owned.rsand theOwned<T>/OwnedIn<T>/DynamicOwned<T>type aliases fromsrc/ptr/lib.rs.These were all trivial
= Box<T>aliases left over from the porting pass, with no remaining callers. The file was ~260 lines of mapping comments plus four helper functions, of which onlyalloc_dupe_slice(a one-line wrapper overBox::<[T]>::from) had any users.Callers updated:
src/s3_signing/credentials.rs:dupe_slice(&self.field)onBox<[u8]>fields replaced withself.field.clone()src/runtime/test_runner/diff/diff_match_patch.rs:alloc_dupe_sliceimport replaced with a localfn dupe<T: Clone>(s: &[T]) -> Box<[T]>(30+ call sites, not worth inlining each)Also updates two stale doc comments in
bun_allocthat referenced the deleted aliases.Net: +23 / -304.