Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fa4b618
feat: add syntax macro
alejandro-vaz Oct 17, 2026
9f5b4dc
docs: add nightly warning
alejandro-vaz Oct 18, 2026
057ad5c
fix: markdownlint
alejandro-vaz Oct 18, 2026
0114f26
fix: no markdown trailing space
alejandro-vaz Oct 18, 2026
b2bb339
Merge branch 'v2' into add-syntax
alejandro-vaz Oct 19, 2026
df50f48
Merge branch 'v2' into add-syntax
alejandro-vaz Oct 20, 2026
c47d1cb
style: formatting
alejandro-vaz Oct 20, 2026
68727c1
fix: publish workaround
alejandro-vaz Oct 20, 2026
fdc537e
refactor: remove crate
alejandro-vaz Oct 20, 2026
1558425
refactor: rename file
alejandro-vaz Oct 20, 2026
91009f5
refactor: removed conditional syntax
alejandro-vaz Oct 20, 2026
0a2b48f
fix: rustdoc
alejandro-vaz Oct 20, 2026
2e12574
fix: where rustdoc
alejandro-vaz Oct 20, 2026
4d4e891
fix: rustdoc failure
alejandro-vaz Oct 20, 2026
08bd5a1
refactor: rename
alejandro-vaz Oct 20, 2026
33d905e
fix: rename
alejandro-vaz Oct 20, 2026
75bb404
fix: vscode lint
alejandro-vaz Oct 20, 2026
32c89dd
refactor: clean build script
alejandro-vaz Oct 20, 2026
6a5b6ec
feat: restore agents.md
alejandro-vaz Oct 20, 2026
0a14621
style: formatting
alejandro-vaz Oct 20, 2026
944ded1
refactor: simplify macro
alejandro-vaz Oct 20, 2026
aa6ffb1
chore: restore exclude
alejandro-vaz Oct 20, 2026
dd32584
docs: restore final newline
alejandro-vaz Oct 20, 2026
be698b6
feat: macro crate
alejandro-vaz Oct 20, 2026
19a01dc
Merge branch 'v2' into add-syntax
alejandro-vaz Oct 20, 2026
466b897
Merge branch 'v2' into add-syntax
alejandro-vaz Oct 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
target
/.vscode
29 changes: 17 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 21 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "smallvec"
version = "2.0.0-beta.3"
edition = "2024"
rust-version = "1.86"
authors = ["The Servo Project Developers"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/servo/rust-smallvec"
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "'Small vector' optimization: store up to a small number of items on the stack"
keywords = ["small", "vec", "vector", "stack", "no_std"]
categories = ["data-structures"]
exclude = [".gitignore", "tests/", "fuzz/", "benches/", ".github/"]
exclude = [".gitignore", "tests/", "fuzz/", "benches/", ".github/", "rustfmt.toml", ".vscode/"]

[profile.bench]
lto = "fat"
Expand All @@ -18,26 +18,20 @@ opt-level = 3
debug = false
strip = true

# Dedicated profile for the iai-callgrind benchmarks. Callgrind needs the
# function symbols in the binary to attribute event counts, so we disable
# stripping (and keep debug info for line-level detail). Without symbols the
# runner collects zero events for every benchmark. LTO is left on (inherited)
# since it does not affect collection and keeps the run representative.
[profile.callgrind]
inherits = "bench"
debug = 1
debug = true
strip = false

[features]
allocator-api = []
allocator-api2 = ["dep:allocator-api2", "allocator-api"]
allocator-api2 = ["allocator-api", "dep:allocator-api2"]
internals = []
proptest = ["dep:proptest", "std"]
rayon = ["std", "dep:rayon"]
rayon = ["dep:rayon", "std"]
serde = ["dep:serde_core"]
specialization = []
std = []
zeroize = ["dep:zeroize"]

[dependencies]
allocator-api2 = { version = "0.4", optional = true, features = [
Expand All @@ -58,12 +52,13 @@ proptest = { version = "1", optional = true, features = [
], default-features = false }
rayon = { version = "1", optional = true, default-features = false }
serde_core = { version = "1", optional = true, default-features = false }
smallvec-macro = { version = "0.0.0", path = "./macro", default-features = false }
zeroize = { version = "1", optional = true, default-features = false }

[dev-dependencies]
serde_test = "1"
criterion = "0.8"
iai-callgrind = "0.14"
iai-callgrind = "0.16"

[[test]]
name = "arbitrary"
Expand Down Expand Up @@ -116,4 +111,13 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
members = [".", "fuzz"]
package.edition = "2024"
package.authors = ["The Servo Project Developers"]
package.license = "MIT OR Apache-2.0"
package.repository = "https://github.com/servo/rust-smallvec"
package.rust-version = "1.86"
resolver = "3"
members = [
".",
"fuzz"
]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ v.sort();
> [!NOTE]
>
> - SmallVec without any features enabled does not make use of the standard library.
> - The `rayon` feature implicitly requires `std`.
> - The `allocator-api2` feature requires `allocator-api`
> - The `rayon` and `proptest` features implicitly require `std`.
> - The `allocator-api2` feature requires `allocator-api`, though it does not
require `nightly`
9 changes: 6 additions & 3 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[package]
name = "smallvec-fuzz"
name = "fuzzer"
version = "0.0.0"
authors = ["The Servo Project Developers"]
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
description = "Fuzzer for SmallVec"
publish = false
edition = "2024"

[package.metadata]
cargo-fuzz = true
Expand Down
15 changes: 15 additions & 0 deletions macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "smallvec-macro"
version = "0.0.0"
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "proc-macro crate for SmallVec"
keywords = []
categories = []

[lib]
proc-macro = true
path = "./lib.rs"
30 changes: 30 additions & 0 deletions macro/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use proc_macro::{
Delimiter,
TokenStream,
TokenTree
};

#[proc_macro_attribute]
pub fn syntax(attribute: TokenStream, item: TokenStream) -> TokenStream {
let mut element = Vec::<TokenTree>::new();
let mut iterator = item.into_iter().fuse();
loop {
match [iterator.next(), iterator.next()] {
[
Some(TokenTree::Punct(punctuation)),
Some(TokenTree::Group(group))
] if (punctuation.as_char(), group.delimiter()) == ('#', Delimiter::Bracket) => {
element.extend([punctuation.into(), group.into()]);
}
mut trees => {
element.extend(
attribute
.into_iter()
.chain(trees.iter_mut().flat_map(Option::take))
.chain(iterator)
);
return element.into_iter().collect();
}
};
}
}
10 changes: 3 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ use {
from_raw_parts_mut
}
},
newrange::NewRange
newrange::NewRange,
smallvec_macro::syntax
};
pub use {
error::SmallVecError,
Expand All @@ -141,12 +142,7 @@ pub use {
splice::Splice
}
};
#[cfg(feature = "internals")]
pub use {
locatedlength::LocatedLength,
rawsmallvec::RawSmallVec
};
#[cfg(not(feature = "internals"))]
#[cfg_attr(feature = "internals", syntax(pub))]
use {
locatedlength::LocatedLength,
rawsmallvec::RawSmallVec
Expand Down
Loading