Skip to content

implemented the zerocopy traits for smallVec - #819

Merged
alejandro-vaz merged 8 commits into
servo:v2from
Divyansh089:v2
Oct 31, 2026
Merged

alejandro-vaz merged 8 commits into
servo:v2from
Divyansh089:v2

Conversation

@Divyansh089

Copy link
Copy Markdown
Contributor

Description

  • Add zerocopy as an optional dependency.
  • Introduce a feature-gated integration for applicable zerocopy traits.
  • Implement the traits for SmallVec with the Global allocator.
  • Add integration tests covering zero-initialization, inline storage, heap spilling, zero-sized types, and resource cleanup.

Testing

  • cargo test --test zerocopy --features zerocopy
  • cargo test --lib
  • cargo test --test std --features std

Closes #796

@GauravPawar101
GauravPawar101 self-requested a review October 29, 2026 17:16
Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread Cargo.toml Resolved
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

review it as well @GauravPawar101, that way we get used to having multiple points of view which is always a plus

@GauravPawar101

Copy link
Copy Markdown
Collaborator

Yeah, that's better

Comment thread src/lib.rs Resolved
Comment thread Cargo.toml Resolved
@GauravPawar101

Copy link
Copy Markdown
Collaborator

@alejandro-vaz , I do not think we need a new file and also the zero function is sematically incorrect as according to https://docs.rs/zerocopy/latest/zerocopy/ the drop semantics are wrong. Also, it is provided by zeroize.

Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

I agree the drop behavior seems sketchy to me

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

also you have to run cargo fmt --all

@Divyansh089

Copy link
Copy Markdown
Contributor Author

okay , working on the changes that you both have suggested

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

you have to run cargo fmt --all but on nightly, it won't work on stable

Comment thread tests/zerocopy.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread tests/zerocopy.rs Resolved
Comment thread src/lib.rs Resolved
@GauravPawar101

Copy link
Copy Markdown
Collaborator

All else is fine

Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
Comment thread src/zerocopy.rs Resolved
@alejandro-vaz
alejandro-vaz added this pull request to the merge queue Oct 31, 2026
Merged via the queue into servo:v2 with commit d5b3825 Oct 31, 2026
8 checks passed
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.

implement zerocopy traits for SmallVec

3 participants