Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for no_std #3180

Merged
merged 6 commits into from
Jul 29, 2024
Merged

Fix support for no_std #3180

merged 6 commits into from
Jul 29, 2024

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Jul 29, 2024

Rust's no_std feature doesn't actually verify that dependencies don't silently add a std dependency. It just prevents the current package from taking a direct dependency. This isn't particularly easy to test.

This PR includes a sequence of commits that will verify success/failure before completion.

Fixes: #3163
Fixes: #3164

@kennykerr
Copy link
Collaborator Author

kennykerr commented Jul 29, 2024

OK, we have a green build. 2a40261

The next commit adds a duplicate panic handler. c943804

Duplicate because an indirect std dependency will bring in a panic handler and conflict.

@kennykerr
Copy link
Collaborator Author

And finally, bc4f313 avoids the indirect std dependencies and provides the actual fix to the problem. This ended up requiring a bit more work than was originally suggested by #3164.

dpaoliello
dpaoliello previously approved these changes Jul 29, 2024
crates/tests/no_std/src/lib.rs Show resolved Hide resolved
Copy link
Collaborator

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good solution. An alternative would be to fiddle with harness = false in the Cargo.toml for the test (to disable the libtest harness) but getting that wired up right might be more effort than it's worth.

@kennykerr kennykerr merged commit 429666e into master Jul 29, 2024
78 checks passed
@kennykerr kennykerr deleted the test_no_std branch July 29, 2024 23:46
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.

Windows-core incorrectly propagates the std feature to subcrates
3 participants