Skip to content

fix(build): make the CLI allocators optional for library consumers - #1004

Merged
rvben merged 1 commit into
rvben:mainfrom
polylint:fix/library-allocator
Nov 16, 2026
Merged

rvben merged 1 commit into
rvben:mainfrom
polylint:fix/library-allocator

Conversation

@Goldziher

Copy link
Copy Markdown
Contributor

tikv-jemallocator (and mimalloc/libmimalloc-sys on MSVC) were unconditional target dependencies. A crate that embeds rumdl as a library with default-features = false therefore still linked jemalloc. The library never installs it as the global allocator; the dependency only added a native build and a links = "jemalloc" entry.

That links entry is what breaks consumers. If the embedding project also links a different tikv-jemalloc-sys version, Cargo cannot resolve the graph, because only one package may declare links = "jemalloc". polylint hit this once its other dependencies moved to tikv-jemallocator 0.7.

The allocators are now optional and enabled by the native feature, which is in the default set, so the CLI binary is unchanged. The #[global_allocator] statics and the mimalloc exit-option call are gated on feature = "native" as well.

Checked:

  • cargo tree -e normal -i tikv-jemallocator --no-default-features matches nothing. With default features it still shows rumdl.
  • cargo clippy --all-targets --all-features -- -D warnings -D clippy::uninlined_format_args is clean.
  • cargo check --lib --no-default-features passes.
  • cargo fmt --check is clean.

tikv-jemallocator and mimalloc were unconditional target dependencies, so a crate that embeds
rumdl as a library with default-features = false still linked jemalloc. The library never
installs it as the global allocator; it only adds a native build and a links = "jemalloc" entry,
which fails resolution as soon as the embedding crate links a different tikv-jemalloc-sys.

The allocators are now optional and enabled by the native feature, which the CLI builds with by
default, so the binary is unchanged.
Goldziher added a commit to polylint/rumdl that referenced this pull request Nov 16, 2026
Picks up the optional CLI allocators (rvben#1004), so embedding the library no longer links jemalloc.
Goldziher added a commit to polylint/polylint that referenced this pull request Nov 16, 2026
Upstream rumdl 0.3.4 builds on Oxc 0.137, so the web component linked a
second oxc next to poly's 0.158, plus rumdl's unconditional jemalloc.
polylint-rumdl 0.3.5 is polylint's fork on Oxc 0.158 with the CLI
allocators optional (rvben/rumdl#1003, rvben/rumdl#1004), and adrlint
0.5.2 depends on it, so upstream rumdl leaves the graph entirely. The
lib name stays rumdl_lib, so no source changes; the engine versions
move so cached results are recomputed (#192).

components/Cargo.lock duplicates (package names locked at more than one
version): 67 -> 54. oxc: 12 duplicated crates (0.137 + 0.158) -> 0.
`cargo tree -d -e normal --target all` lists no oxc_, rumdl or
tikv-jemalloc entry, and tikv-jemallocator is no longer in the graph
(was 0.6.1 through rumdl).
@rvben
rvben merged commit 0f735c2 into rvben:main Nov 16, 2026
16 checks passed
rvben added a commit that referenced this pull request Nov 16, 2026
Merges polylint/rumdl. Raises the MSRV to 1.97, moves the MDX parser to
Oxc 0.158 and upgrades all dependencies. Conflict resolution keeps
tikv-jemallocator optional (as introduced in #1004) at the upgraded 0.7,
and states the 1.97 MSRV under the rolling-window policy.
@rvben

rvben commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Thanks @Goldziher, this was a clear diagnosis: the library never installs the allocator, so the dependency only added a native build and the links = "jemalloc" conflict. The allocators are now optional in the default native feature, and the change will be in the next release.

One gap remains, and we'll close it ourselves: native also gates library code (the workspace index, user config paths, the LSP), so a consumer that enables native without the default features still links jemalloc. We'll move the allocators into their own default feature so native no longer pulls them in. If polylint only uses default-features = false without native, you're already covered.

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