alexcrichton opened PR #14184 from alexcrichton:bump-msrv to bytecodealliance:main:
Coupled with today's release of Rust 1.98.0
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested fitzgen for a review on PR #14184.
alexcrichton requested wasmtime-default-reviewers for a review on PR #14184.
:thumbs_up: pchickey submitted PR review.
alexcrichton requested wasmtime-core-reviewers for a review on PR #14184.
alexcrichton updated PR #14184.
alexcrichton commented on PR #14184:
Our MinGW target is broken with Rust 1.98.0 due to what I believe is https://github.com/rust-lang/rust/pull/148799. I've reached out on that PR to see if my latest commit here is the right approach, and in the meantime I'd prefer to not merge this until that's vetted.
ohadravid commented on PR #14184:
@alexcrichton I'll look into it tomorrow :mine:
alexcrichton commented on PR #14184:
Many thanks, and no rush!
ohadravid commented on PR #14184:
OK quick note: not sure why only on mingw, but I think the problem is that the
thread_local/guard/windows.rs::enablehook in std is registered too late: instead of during the thread creation, it happens after a fiber is already running.Later, the a different fiber is converted back to a thread and deletes the original fiber which triggers the FLS destructors prematurely.
I think a more correct solution is to also call the
struct Guard;inFiber::new(not sure if can be _moved_ entirely), but I'll be able to test this only tomorrow since I need to setup the env for this.Also, I think std might want to avoid registering the hook when running in a fiber because of this - we already leak if the dtors are in a fiber, and it makes more sense to leak if we start in a fiber anyway. I'll add a test there and fix that.
ohadravid edited a comment on PR #14184:
OK quick note: not sure why only on mingw, but I think the problem is that the
thread_local/guard/windows.rs::enablehook in std is registered too late: instead of during the thread creation, it happens after a fiber is already running.Later, a different fiber is (1) converted back to a thread and (2) deletes the original fiber which triggers the FLS destructors prematurely.
I think a more correct solution is to also call the
struct Guard;inFiber::new(not sure if can be _moved_ entirely), but I'll be able to test this only tomorrow since I need to setup the env for this.Also, I think std might want to avoid registering the hook when running in a fiber because of this - we already leak if the dtors are in a fiber, and it makes more sense to leak if we start in a fiber anyway. I'll add a test there and fix that.
ohadravid commented on PR #14184:
Actually, the fix here is the correct one for now, but I still need fix this in std :bug: .
In detail: we had issues with mingw in the original PR as well, because it doesn't have
#[thread_local]. Because of that, we don't know if theenablehook was registered in the _thread_ already (which requires a#[thread_local] REGISTERED: Cell<bool>), so _every_ TLS access unconditionally set the the internal flag that triggers the dtors.
The fix will be to bail early ifIsThreadAFiberinenable.So, in summary: in mingw every TLS from a Fiber will cause dtors to be registered and incorrectly run when that Fiber is deleted if the deletion is not in a Fiber, so converting to Fiber in the
dropis the best solution for now.
:thumbs_up: ohadravid submitted PR review.
ohadravid edited a comment on PR #14184:
Actually, the fix here is the correct one for now, but I still need fix this in std :bug: .
In detail: we had issues with mingw in the original PR as well, because it doesn't have
#[thread_local]. Because of that, we don't know if theenablehook was registered in the _thread_ already (which requires a#[thread_local] REGISTERED: Cell<bool>), so _every_ TLS access unconditionally set the the internal flag that triggers the dtors.This means that in mingw fibers are almost guaranteed to arm that internal flag and trigger the dtors. The result is that deleting the fiber when the caller is converted back to thread will trigger the dtors before thread exit, which is bug.
The fix will be to bail early ifIsThreadAFiberinenable, which prevents this kind of behavior.So, in summary: in mingw every TLS from a Fiber will cause dtors to be registered and incorrectly run when that Fiber is deleted if the deletion is not in a Fiber, so converting to Fiber in the
dropis the best solution for now.
alexcrichton commented on PR #14184:
Thanks @ohadravid!
alexcrichton added PR #14184 Bump MSRV to 1.96.0 to the merge queue.
:check: alexcrichton merged PR #14184.
alexcrichton removed PR #14184 Bump MSRV to 1.96.0 from the merge queue.
Last updated: Aug 30 2026 at 09:07 UTC