Skip to content

Delete src/ptr/owned.rs - #34763

Merged
dylan-conway merged 1 commit into
mainfrom
claude/farm/75953c63/delete-owned-rs
Jul 20, 2026
Merged

dylan-conway merged 1 commit into
mainfrom
claude/farm/75953c63/delete-owned-rs

Conversation

@robobun

@robobun robobun commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Deletes src/ptr/owned.rs and the Owned<T> / OwnedIn<T> / DynamicOwned<T> type aliases from src/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 only alloc_dupe_slice (a one-line wrapper over Box::<[T]>::from) had any users.

Callers updated:

  • src/s3_signing/credentials.rs: dupe_slice(&self.field) on Box<[u8]> fields replaced with self.field.clone()
  • src/runtime/test_runner/diff/diff_match_patch.rs: alloc_dupe_slice import replaced with a local fn dupe<T: Clone>(s: &[T]) -> Box<[T]> (30+ call sites, not worth inlining each)

Also updates two stale doc comments in bun_alloc that referenced the deleted aliases.

Net: +23 / -304.

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.
@robobun

robobun commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 9:30 PM PT - Jul 19th, 2026

@robobun, your commit d94e663 is building: #75983

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 10 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3fb91350-044d-4906-ad52-7e636ec4d078

📥 Commits

Reviewing files that changed from the base of the PR and between bb095b3 and d94e663.

📒 Files selected for processing (6)
  • src/bun_alloc/lib.rs
  • src/bun_alloc/maybe_owned.rs
  • src/ptr/lib.rs
  • src/ptr/owned.rs
  • src/runtime/test_runner/diff/diff_match_patch.rs
  • src/s3_signing/credentials.rs

Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

No test added: this is a dead-code deletion with no observable behavior change.

  • The Owned<T> / Dynamic<T> / OwnedIn<T> / Unmanaged<T> / DynamicOwned<T> aliases had zero callers (verified by rg across the workspace); deleting an unused type alias has no fail-before state.
  • The two live call sites were rewritten to their semantic equivalents: dupe_slice(&box_field) is Box::<[u8]>::from(&*box_field) which is exactly box_field.clone(), and the local dupe helper in diff_match_patch.rs has the identical body to the deleted alloc_dupe_slice.

bun bd builds clean and the diff-match-patch tests (test/regression/issue/10380/spy-matchers-diff.test.ts) pass. Ready for review.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — mechanical removal of dead Box<T> aliases and their porting-notes file.

What was reviewed:

  • Grepped src/ for remaining references to bun_ptr::owned, Owned/OwnedIn/DynamicOwned, alloc_dupe_slice, and the other deleted helpers — none remain (the one bun.ptr.OwnedIn hit in shared.rs is a historical Zig doc-comment, not a type reference).
  • credentials.rs: fields are Box<[u8]>, so self.field.clone() is byte-for-byte equivalent to the old dupe_slice(&self.field).
  • diff_match_patch.rs: local fn dupe is identical to the deleted alloc_dupe_slice body.
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) where field: Box<[u8]> → self.field.clone(). impl<T: Clone> Clone for Box<[T]> allocates and copies exactly like Box::<[T]>::from(&*b).
  • The imported alloc_dupe_slice as dupe → a local fn 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.

@dylan-conway
dylan-conway merged commit b82a43f into main Jul 20, 2026
59 of 69 checks passed
@dylan-conway
dylan-conway deleted the claude/farm/75953c63/delete-owned-rs branch July 20, 2026 04:55
dylan-conway pushed a commit that referenced this pull request Jul 20, 2026
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.
dylan-conway pushed a commit that referenced this pull request Jul 20, 2026
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>
dylan-conway pushed a commit that referenced this pull request Jul 20, 2026
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants