【Rust】fibonacci関数にcoroutineを組み合わせたい

関数の呼び出しの中でcoroutineを使用する。返り値にimpl Coroutineと書くと、期待通りの挙動になる。

#![feature(coroutines)]
#![feature(coroutine_trait)]
#![feature(stmt_expr_attributes)]

use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;

fn test() -> impl Coroutine{
    let mut coroutine = #[coroutine] || {
        println!("2");
        yield;
        println!("4");
    };
    return coroutine
}

fn main() {
    
    let mut coroutine = test();

    println!("1");
    Pin::new(&mut coroutine).resume(());
    println!("3");
    Pin::new(&mut coroutine).resume(());
    println!("5");
}

Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.22s
Running `target/debug/parallel`
1
2
3
4
5

fn fibonacci(n: u32)-> u32{
    if(n == 1) || (n == 2) {
        return 1;
    }
    return coroutines::spawn(move ||fibonacci(n - 2)).join().unwrap() + coroutines::spawn(move ||fibonacci(n - 1)).join().unwrap();
}

fn main() {
    println!("{}", fibonacci(8));
}

error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL=”C” PATH=”/home/vagrant/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/home/vagrant/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/bin/remote-cli:/home/vagrant/.local/bin:/home/vagrant/.cargo/bin:/home/vagrant/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin” VSLANG=”1033″ “cc” “/tmp/rustclduixt/symbols.o” “<71 object files omitted>” “-Wl,–as-needed” “-Wl,-Bstatic” “/home/vagrant/dev/rust/parallel/target/debug/deps/{libcoroutines-73d67594ef572d45.rlib,libspin-b921464275125a8a.rlib}” “/home/vagrant/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib/{libstd-37c91c156f70721a.rlib,libpanic_unwind-091ab8f68cc61686.rlib,libobject-e2f7a15061957456.rlib,libmemchr-c98c798b414d6437.rlib,libaddr2line-9aff78f201895d3e.rlib,libgimli-136ec4cd87684724.rlib,librustc_demangle-de97401acb73e7bd.rlib,libstd_detect-c05658b587ae52a4.rlib,libhashbrown-64cb6e685fd4789d.rlib,librustc_std_workspace_alloc-83e0c642422571d6.rlib,libminiz_oxide-37d00f2abcaa32e0.rlib,libadler2-4baacb3803247097.rlib,libunwind-7fc1e71b6d069b5b.rlib,libcfg_if-96e210777df10d05.rlib,liblibc-910d42f9f92e088d.rlib,liballoc-8d48e7538af467a9.rlib,librustc_std_workspace_core-1afa26d7618dba03.rlib,libcore-a40bbbb3fb06de3c.rlib,libcompiler_builtins-2b4a3d060745bb29.rlib}” “-Wl,-Bdynamic” “-lunblock_hook” “-lgcc_s” “-lutil” “-lrt” “-lpthread” “-lm” “-ldl” “-lc” “-Wl,–eh-frame-hdr” “-Wl,-z,noexecstack” “-L” “/home/vagrant/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/lib” “-o” “/home/vagrant/dev/rust/parallel/target/debug/deps/parallel-9e5acb293a2c78f7” “-Wl,–gc-sections” “-pie” “-Wl,-z,relro,-z,now” “-nodefaultlibs”
= note: some arguments are omitted. use `–verbose` to show all linker arguments
= note: /usr/bin/ld: cannot find -lunblock_hook: No such file or directory
collect2: error: ld returned 1 exit status

うーん、わからん…