Closed Nemo157 closed 6 years ago
Ugh this is quite problematic! Once Pin stuff lands, we can make changes to generators so that this unsafe block should be going away, but until then... cc @cramertj
Please backport this to 0.1.x while 0.2.x is still alpha.
Compiling futures-await v0.1.0
error[E0133]: call to unsafe function requires unsafe function or block
--> C:\Users\Arnavion\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-await-0.1.0\src\lib.rs:123:19
|
123 | match self.0.resume() {
| ^^^^^^^^^^^^^^^ call to unsafe function
error[E0133]: call to unsafe function requires unsafe function or block
--> C:\Users\Arnavion\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-await-0.1.0\src\lib.rs:143:19
|
143 | match self.gen.resume() {
| ^^^^^^^^^^^^^^^^^ call to unsafe function
See #79, this is actually about the inverse problem where you could use unsafe functions without adding an unsafe
block to your code.
As an example, running this will segfault without any warnings:
while the same example with
s/async/async_move/
will fail to compile:This appears to be caused by this unhygenic
unsafe
block, I assume this has something to do with self-referential generators, but I'm hoping there's some way to fix this to avoid accidental unsafety.