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

multicore::Core::spawn's entrypoint should return ! according to docs #912

Closed
not-nullptr opened this issue Mar 18, 2025 · 4 comments
Closed

Comments

@not-nullptr
Copy link

from the docs:

Spawn a function on this core.
The closure should not return. It is currently defined as -> () because -> ! is not yet stable.

returning ! has been stable for a while now -- the following code compiles under rustc 1.85.0:

fn core_entry() -> ! {
    loop {}
}
@ithinuel
Copy link
Member

Our current MSRV is 1.79.
I searched in the release note but couldn’t find an official statement about it.
Could you share a link to the announcement please (or the relevant tracking issue)?

@not-nullptr
Copy link
Author

rust-lang/rust#65355 ! was stabilised in rust 1.41.0

@ithinuel
Copy link
Member

ithinuel commented Mar 18, 2025

Ah right, I see the missundestanding.

You can indeed use the ! type in the return position of a closure or a function.
However, you still cannot define a bound to an FnOnce() -> ! which is what the definition of spawn would need.

This causes:

error[E0658]: the `!` type is experimental
   --> src/multicore.rs:262:24
    |
262 |         F: FnOnce() -> ! + Send + 'static,
    |                        ^
    |
    = note: see issue #35121 <https://github.com/rust-lang/rust/issues/35121> for more information

@not-nullptr
Copy link
Author

what a shame... hope its stabilised soon. thanks!

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

No branches or pull requests

2 participants