Make component-model-async feature no_std-compatible #13533
Merged
Merged
Conversation
This commit goes through the remaining bits of Wasmtime's `component-model-async` feature and gets everything compiling with `no_std` targets. The notable changes here are: * Two `Mutex`es were replaced with a new custom `TryMutex` type. Usage panics on contention because contention should not be possible in the current architecture. * TLS has been extended in the `custom` API to take an index of which TLS slot to access. Notably Wasmtime now requires two TLS slots instead of one. prtest:full
fitzgen
approved these changes
Jun 2, 2026
| /// | ||
| /// The returned `TryMutexGuard` is an RAII guard to unlock this lock when | ||
| /// dropped. | ||
| pub fn try_lock(&self) -> Option<TryMutexGuard<'_, T>> { |
Member
There was a problem hiding this comment.
Maybe this should return a Result<TryMutexGuard> and bail_bug! on contention?
Member
Author
There was a problem hiding this comment.
I liked this idea, then realized I should also be adding at least a simple smoke test for this type, then realized that bail_bug! would make this more difficult to test. Given that I think this'll stay as-is as I think it might still be a useful primitive elsewhere for "just make this thing Sync and/or `"just make this thing mutable" in cases where contention may or may not be fatal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit goes through the remaining bits of Wasmtime's
component-model-asyncfeature and gets everything compiling withno_stdtargets. The notable changes here are:Two
Mutexes were replaced with a new customTryMutextype. Usagepanics on contention because contention should not be possible in the
current architecture.
TLS has been extended in the
customAPI to take an index of whichTLS slot to access. Notably Wasmtime now requires two TLS slots
instead of one.