Skip to content

Add testing and benchmarking steps with --no-default-features - #610

Merged
alejandro-vaz merged 3 commits into
servo:v2from
pedrodesu:no-default-features-step
Sep 14, 2026
Merged

Add testing and benchmarking steps with --no-default-features#610
alejandro-vaz merged 3 commits into
servo:v2from
pedrodesu:no-default-features-step

Conversation

@pedrodesu

Copy link
Copy Markdown
Contributor

Fixes #605.

@pedrodesu

pedrodesu commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

The code at the previous point imported Allocator and Global incorrectly from alloc (instead of alloc::alloc), thus it failed. Additionally, we must force the allocator_api feature if we're not using the default allocator-api2 feature.

I also changed the extern of std, it's redundant since it's under the feature of std. I believe it's better to just invert the logic and only toggle #![no_std] if the std feature isn't present.

My PR reflects these changes.

One thing to bear in mind: Our current code forces the usage of an allocator API, whether nightly allocator_api or allocator-api2's. This means that if a user on stable rust disables allocator-api2, our library would never compile as-is (indeed, if you hypothetically ran Cargo test no default features under stable, surely the action would fail).
Nothing needs to be changed if that's deliberate, but if not, we should probably add more conditional code to fallback to the API of no custom allocators if we don't detect either nightly or allocator-api2. This, of course, has the price of more code.

@alejandro-vaz

Copy link
Copy Markdown
Collaborator

thanks, looks good.

@alejandro-vaz
alejandro-vaz added this pull request to the merge queue Sep 14, 2026
Merged via the queue into servo:v2 with commit b5fc61f Sep 14, 2026
6 checks passed
@pedrodesu
pedrodesu deleted the no-default-features-step branch September 14, 2026 11:38
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.

add --no-default-features steps to CI

2 participants