Skip to content

docs: stop using deprecated smallvec! macro in README example - #520

Merged
alejandro-vaz merged 1 commit into
servo:v2from
painbaba:docs/readme-deprecated-macro
Aug 30, 2026
Merged

docs: stop using deprecated smallvec! macro in README example#520
alejandro-vaz merged 1 commit into
servo:v2from
painbaba:docs/readme-deprecated-macro

Conversation

@painbaba

Copy link
Copy Markdown
Contributor

Fixes #518.

What

The README example still showcased the smallvec! macro, which has been deprecated since 2.0.0-alpha.13 (see #445, deprecation notes in src/lib.rs: use SmallVec::from instead). This PR updates the example to the blessed API:

let mut v: SmallVec<i32, 4> = SmallVec::from([1, 2, 3, 4]);

and drops the macro from the use statement. It also removes a line of trailing whitespace that was on the old import line.

Why

New users copy the README first. Advertising a deprecated macro in the flagship example pushes them toward code that emits deprecation warnings on day one, contradicting the crate's own guidance from #445.

Verification

  • SmallVec::from([T; M]) is provided by the unconditional impl<T, const N: usize, const M: usize> From<[T; M]> for SmallVec<T, N> (src/lib.rs, line ~2726) - no feature gate, works in no_std core contexts just like the macro did.
  • The README block is not a doctest (not include_str!-ed into lib.rs), so no test churn; example semantics are unchanged (4 inline elements, spill on push(5)).

Note / possible follow-up

src/lib.rs line ~1903 still uses smallvec![1, 2, 3] inside a doctested example on as_mut_ptr (that one IS compiled by CI). Left out of this PR to keep it docs-only and scoped to #518 - happy to do a follow-up if useful.

The smallvec! macro has been deprecated since 2.0.0-alpha.13
(note: 'use SmallVec::from instead'). Replace the README example
with SmallVec::from([...]) and drop the macro from the use
statement. Also strips trailing whitespace on the removed line.

Fixes servo#518.
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

is this ready for review

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

it looks like to me

@alejandro-vaz
alejandro-vaz marked this pull request as ready for review August 30, 2026 23:57
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

AI contributions are not allowed in any @servo repository

https://book.servo.org/contributing/getting-started.html#ai-contributions

thanks for contributing

@alejandro-vaz
alejandro-vaz added this pull request to the merge queue Aug 30, 2026
Merged via the queue into servo:v2 with commit c06b1dd Aug 30, 2026
6 checks passed
@alejandro-vaz

Copy link
Copy Markdown
Collaborator

I'm not sure if you're a human being or not, I've received way too many AI PRs recently

if you want you can try #491, it's also docs

thank you for your contribution

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.

update README.md example to not use the smallvec! macro

2 participants