Skip to content

Fix fuzzing problems - #676

Open
pedrodesu wants to merge 9 commits into
servo:v2from
pedrodesu:new-fuzzing
Open

pedrodesu wants to merge 9 commits into
servo:v2from
pedrodesu:new-fuzzing

Conversation

@pedrodesu

@pedrodesu pedrodesu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

These changes should make fuzzing pass. Such is the case in my machine, running for 2 minutes and through different runs. We will have more concrete results when we have this version running via cron for longer periods.

Comment thread src/lib.rs
Comment thread src/lib.rs
Comment thread src/lib.rs
Comment thread tests/main.rs
@pedrodesu

pedrodesu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Additionally, I'd like to take a moment here to talk about the naming of grow and try_grow: Does it make sense? From the name of the function, one would expect it to work the same as std's reserve I think. But instead of increasing the capacity by N, we set it to N. It's not what I would call a function with this behavior, personally. Feels like a misnomer. Some additional food for thought.

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

what name are you suggesting then??

@pedrodesu

pedrodesu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

How about something like set_min_capacity or reserve_total? I'm personally more of a fan of the former, but the latter seems more akin to what the user might expect (as std has reserve). Both show that it's an absolute operation and that we're always at best growing the vector (although the input is in absolute terms!), not shrinking.

@pedrodesu

pedrodesu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Additionally, is there a reason why we don't implement reserve and friends? And perhaps such other functions from Vec at that?

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

yeah I'd say we should implement reserve and its derivatives, and some that may be useful in our code, though not in order to fill API gaps

I'd honestly go with the reserve variants instead of set just to make it somewhat relatable to Vec

@pedrodesu

pedrodesu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

I agree. Anyway, this is a bit off-topic to this PR, so I'd suggest creating another issue for this matter. I believe the PR is good to go.

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.

2 participants