calebwin / emu

The write-once-run-anywhere GPGPU library for Rust
https://calebwin.github.io/emu
MIT License
1.59k stars 53 forks source link

em compilation fails, traits not implemented, and some missing imports? #49

Open twirrim opened 3 years ago

twirrim commented 3 years ago

rustc 1.53.0 (53cb7b09b 2021-06-17) cargo 1.53.0 (4369396ce 2021-04-27)

Same happens under Windows and Linux (given the errors, I doubted it was an OS level issue)

Steps to recreate:

cargo new emdemo
cd emdemo
echo 'em = "0.3.0"' >> Cargo.toml
cargo build

There's a few errors being reported, Errors messages follow. The first 4 are similar, all in accelerating.rs:

error[E0433]: failed to resolve: could not find `__rt` in `quote`
   --> /home/paul/.cargo/registry/src/github.com-1ecc6299db9ec823/emu_macro-0.1.0/src/accelerating.rs:123:72
    |
123 | ...                   .is_ident(&Ident::new("load", quote::__rt::Span::call_site()))
    |                                                                  ^^^^ not found in `quote::__rt`
    |
help: consider importing one of these items
    |
3   | use crate::Span;
    |
3   | use crate::__private::Span;
    |
3   | use proc_macro2::Span;
    |
3   | use proc_macro::Span;
    |
      and 3 other candidates
error[E0433]: failed to resolve: could not find `__rt` in `quote`
   --> /home/paul/.cargo/registry/src/github.com-1ecc6299db9ec823/emu_macro-0.1.0/src/accelerating.rs:169:72
    |
169 | ...                   .is_ident(&Ident::new("read", quote::__rt::Span::call_site()))
    |                                                                  ^^^^ not found in `quote::__rt`
    |
help: consider importing one of these items
    |
3   | use crate::Span;
    |
3   | use crate::__private::Span;
    |
3   | use proc_macro2::Span;
    |
3   | use proc_macro::Span;
    |
      and 3 other candidates
error[E0433]: failed to resolve: could not find `__rt` in `quote`
   --> /home/paul/.cargo/registry/src/github.com-1ecc6299db9ec823/emu_macro-0.1.0/src/accelerating.rs:193:74
    |
193 | ...                   .is_ident(&Ident::new("launch", quote::__rt::Span::call_site()))
    |                                                                    ^^^^ not found in `quote::__rt`
    |
help: consider importing one of these items
    |
3   | use crate::Span;
    |
3   | use crate::__private::Span;
    |
3   | use proc_macro2::Span;
    |
3   | use proc_macro::Span;
    |
      and 3 other candidates
error[E0433]: failed to resolve: could not find `__rt` in `quote`
   --> /home/paul/.cargo/registry/src/github.com-1ecc6299db9ec823/emu_macro-0.1.0/src/accelerating.rs:259:70
    |
259 |                     let ident = Ident::new(&param.name, quote::__rt::Span::call_site());
    |                                                                      ^^^^ not found in `quote::__rt`
    |
help: consider importing one of these items
    |
3   | use crate::Span;
    |
3   | use crate::__private::Span;
    |
3   | use proc_macro2::Span;
    |
3   | use proc_macro::Span;
    |
      and 3 other candidates

   Compiling num-bigint v0.1.44

Then the 5th is quite different:

error[E0277]: the trait bound `syn::Expr: From<TokenStream2>` is not satisfied
   --> /home/paul/.cargo/registry/src/github.com-1ecc6299db9ec823/emu_macro-0.1.0/src/passing.rs:337:50
    |
337 |                     let gpu_ident = quote! {gpu}.into();
    |                                                  ^^^^ the trait `From<TokenStream2>` is not implemented for `syn::Expr`
    |
    = help: the following implementations were found:
              <syn::Expr as From<ExprArray>>
              <syn::Expr as From<ExprAssign>>
              <syn::Expr as From<ExprAssignOp>>
              <syn::Expr as From<ExprAsync>>
            and 35 others
    = note: required because of the requirements on the impl of `Into<syn::Expr>` for `TokenStream2`
calebwin commented 3 years ago

Hello,

I'm deeply sorry about these issues. I have unfortunately not found the time to tend to these regressions recently. Thank you for reporting this issue though and I sincerely hope that either myself or someone interested in the project can develop fixes for these.

From eyeballing them, they seem like minor issues stemming from API changes in libraries that Emu depends on.

haixuanTao commented 3 years ago

Hey there, if you use the current version in git the error vanishes meaning that it is probably only on the published crate.

To fix it change echo 'em = "0.3.0"' >> Cargo.toml:

echo 'em = {git = "https://github.com/calebwin/emu.git"}' >> Cargo.toml

The git is very big, however, making the compilation really slow...