Skip to content

style: rename alloc to allocator - #642

Closed
Denimworld12 wants to merge 0 commit into
servo:v2from
Denimworld12:rename-alloc-to-allocator
Closed

Denimworld12 wants to merge 0 commit into
servo:v2from
Denimworld12:rename-alloc-to-allocator

Conversation

@Denimworld12

Copy link
Copy Markdown
Contributor

Closes #640.

Renamed the identifier everywhere it appears:

  • the RawSmallVec::allocator and DropDealloc::allocator fields
  • the allocator parameters on new, new_inline, new_heap, new_in, with_capacity_in and try_with_capacity_in
  • every use site

Deliberately left alone, since alloc there is not this identifier:

  • paths into the alloc crate — extern crate alloc, use alloc::alloc::{…}, alloc::vec::Vec, alloc::alloc::handle_alloc_error, and the [dealloc]: alloc::alloc::GlobalAlloc::dealloc doc link
  • three comments using "alloc" as prose, e.g. // and we never alloc null pointer.

Both fields are internal — RawSmallVec::allocator is pub(crate) and DropDealloc is a private struct — so this isn't a public API change. Parameter names are visible in docs but don't affect callers.

Checks

Run locally on stable:

  • cargo build — clean
  • cargo test — 71 + 8 pass
  • cargo clippy --all-targets -- -D warnings — clean

I didn't run cargo fmt. rustfmt.toml uses nightly-only options, so stable rustfmt reformats files across the whole repo, including ones untouched here. Instead I checked that no changed line exceeds max_width = 100, since error_on_line_overflow = true and the rename adds four characters per occurrence.

--all-features and --no-default-features need nightly (#![feature] on specialization / allocator_api); both fail identically on upstream/v2 without this change, so I left them to CI.

@alejandro-vaz alejandro-vaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good but I'd want #637 merged first which is going to change a bunch of this

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

I'm drafting the PR just to mentally mark it as blocked

@alejandro-vaz
alejandro-vaz marked this pull request as draft September 20, 2026 13:57
@alejandro-vaz
alejandro-vaz marked this pull request as ready for review September 21, 2026 15:21
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

I think I fucked it up when merging

@Denimworld12

Copy link
Copy Markdown
Contributor Author

@alejandro-vaz Do you want me to rebase it onto the current v2 and resolve the conflicts?

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

yeah do it, more conflicts have appeared

@Denimworld12
Denimworld12 force-pushed the rename-alloc-to-allocator branch from c65d765 to 8ea4861 Compare September 21, 2026 18:29
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

what happened??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename alloc to allocator

2 participants