blackjack icon indicating copy to clipboard operation
blackjack copied to clipboard

Errors when running `cargo run` on MacOS

Open CATboardBETA opened this issue 3 years ago • 0 comments

Hallo! After I run everything with git (including LFS), and run cargo run, I get this error:

   Compiling blackjack_nodes v0.1.0 (/Users/will/blackjack/blackjack)
error[E0053]: method `source` has an incompatible type for trait
 --> src/lua_engine/lua_stdlib/lua_node_libraries.rs:8:25
  |
8 |     fn source(&self) -> &[u8] {
  |                         ^^^^^
  |                         |
  |                         expected enum `std::result::Result`, found `&[u8]`
  |                         help: change the output type to match the trait: `std::result::Result<Cow<'_, [u8]>, std::io::Error>`
  |
  = note: expected fn pointer `fn(&LuaSourceFile) -> std::result::Result<Cow<'_, [u8]>, std::io::Error>`
             found fn pointer `fn(&LuaSourceFile) -> &[u8]`

error[E0053]: method `name` has an incompatible type for trait
  --> src/lua_engine/lua_stdlib/lua_node_libraries.rs:12:23
   |
12 |     fn name(&self) -> Option<std::ffi::CString> {
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^
   |                       |
   |                       expected struct `std::string::String`, found struct `CString`
   |                       help: change the output type to match the trait: `std::option::Option<std::string::String>`
   |
   = note: expected fn pointer `fn(&LuaSourceFile) -> std::option::Option<std::string::String>`
              found fn pointer `fn(&LuaSourceFile) -> std::option::Option<CString>`

error[E0277]: the trait bound `&str: mlua::AsChunk<'_>` is not satisfied
    --> src/lua_engine.rs:27:14
     |
27   |     lua.load(&lua_program).exec()?;
     |         ---- -^^^^^^^^^^^
     |         |    |
     |         |    the trait `mlua::AsChunk<'_>` is not implemented for `&str`
     |         |    help: consider removing the leading `&`-reference
     |         required by a bound introduced by this call
     |
     = help: the following implementations were found:
               <str as mlua::AsChunk<'lua>>
               <std::string::String as mlua::AsChunk<'lua>>
note: required by a bound in `mlua::Lua::load`
    --> /Users/will/.cargo/registry/src/github.com-1ecc6299db9ec823/mlua-0.8.0-beta.4/src/lua.rs:1360:12
     |
1360 |         S: AsChunk<'lua> + ?Sized,
     |            ^^^^^^^^^^^^^ required by this bound in `mlua::Lua::load`

Some errors have detailed explanations: E0053, E0277.
For more information about an error, try `rustc --explain E0053`.
error: could not compile `blackjack_nodes` due to 3 previous errors

What is the problem, how can I fix it?

CATboardBETA avatar Apr 26 '22 15:04 CATboardBETA