shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

[Bug]: shuttle-next rust-analyzer/cargo check warnings

Open oddgrd opened this issue 2 years ago • 0 comments

What happened?

When running rust-analyzer in a shuttle-next project (or cargo check) it will error on "could not find wasi in os. This is because unless passed --target wasm32-wasi cargo won't have the wasi APIs at compile-time. We should find a way to make shuttle-next projects not have these errors. Do we perhaps need to add cfg(wasm32-wasi) flags on wasi api's in shuttle-next, and just panicking in the inverse case? Can we add anything to Cargo.toml about the target?

Version

v0.16.0

Which operating systems are you seeing the problem on?

Linux

Which CPU architectures are you seeing the problem on?

x86_64

Relevant log output

❯ cargo check
    Checking hello-world v0.1.0 (/home/oddgrd/dev/shuttle/examples/next/hello-world)
error[E0433]: failed to resolve: could not find `wasi` in `os`
  --> src/lib.rs:1:1
   |
1  | / shuttle_next::app! {
2  | |     use futures::Tr...
3  | |     use tracing::de...
4  | |     use shuttle_nex...
...  |
32 | |     }
33 | | }
   | |_^ could not find `wasi` in `os`
   |
   = note: this error originates in the macro `shuttle_next::app` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `from_raw_fd` found for struct `File` in the current scope
  --> src/lib.rs:1:1
   |
1  | / shuttle_next::app! {
2  | |     use futures::Tr...
3  | |     use tracing::de...
4  | |     use shuttle_nex...
...  |
32 | |     }
33 | | }
   | | ^
   | |_|
   |   function or associated item not found in `File`
   |
   = help: items from traits can only be used if the trait is in scope
   = note: this error originates in the macro `shuttle_next::app` (in Nightly builds, run with -Z macro-backtrace for more info)
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
1  | use std::os::fd::FromRawFd;
   |

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `hello-world` due to 2 previous errors

Duplicate declaration

  • [X] I have searched the issues and there are none like this.

oddgrd avatar May 09 '23 16:05 oddgrd