tokio-rs / tokio-uring

An io_uring backed runtime for Rust
MIT License
1.11k stars 117 forks source link

Not in a runtime context is not always true #270

Open cholcombe973 opened 1 year ago

cholcombe973 commented 1 year ago

I'm importing a library that uses tokio_uring's upstream git version and if I try to spawn it with tokio_uring::start and the 0.4.0 version it get an error saying: 'Not in a runtime context' which is not correct. I believe the expect calls are masking the actual issue.

Noah-Kennedy commented 1 year ago

Can you upload some code to help us reproduce?

cholcombe973 commented 1 year ago

Sure I can try to put together a little example. I think basically the issue is that if you have a rust workspace with a library and a binary and they're both using different versions of tokio_uring it'll cause this not a runtime context error to be thrown upon startup.

Noah-Kennedy commented 1 year ago

Ah, I see, cargo is linking these as separate crates, so the 0.4.0 version doesn't see the runtime from the git version.

cholcombe973 commented 1 year ago

Yeah it might just be a documentation issue to warn people. I realize what I'm doing is pretty far off the beaten path

Noah-Kennedy commented 1 year ago

Not really, I just need to finish the in-progress work and get a release out.