-
Notifications
You must be signed in to change notification settings - Fork 251
Closed
Labels
gen-rustRelated to bindings for Rust-compiled-to-WebAssemblyRelated to bindings for Rust-compiled-to-WebAssemblyresourcesIssues with component resources and using themIssues with component resources and using them
Description
This repository:
https://github.com/sunfishcode/import-export-demo
contains a wit-bindgen project which imports provider.wit:
resource thing {
frob: function()
}and exports runner.wit:
use { thing } from provider
doit: function(it: thing)in a simple Rust program:
wit_bindgen_rust::import!("provider.wit");
wit_bindgen_rust::export!("runner.wit");
struct Exports;
impl runner::Runner for Exports {
fn doit(it: provider::Thing) {
it.frob()
}
}It currently gets this error:
$ cargo build --target=wasm32-wasi
Compiling import-export-demo v0.0.0 (/home/sunfish/import-export-demo)
error[E0412]: cannot find type `Thing` in module `super`
--> src/lib.rs:2:1
|
2 | wit_bindgen_rust::export!("runner.wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `super`
|
= note: consider importing this struct:
crate::provider::Thing
= note: this error originates in the macro `wit_bindgen_rust::export` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Runner` in module `super`
--> src/lib.rs:2:1
|
2 | wit_bindgen_rust::export!("runner.wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `super`
|
= note: consider importing this trait:
crate::runner::Runner
= note: this error originates in the macro `wit_bindgen_rust::export` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Runner` in module `super`
--> src/lib.rs:2:1
|
2 | wit_bindgen_rust::export!("runner.wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `super`
|
= note: this error originates in the macro `wit_bindgen_rust::export` (in Nightly builds, run with -Z macro-backtrace for more info)
Looking at the code in gen-rust, I see methods like handle_in_super and handle_projection which look like they're related to this, but it's not clear to me what they need to do here.
Metadata
Metadata
Assignees
Labels
gen-rustRelated to bindings for Rust-compiled-to-WebAssemblyRelated to bindings for Rust-compiled-to-WebAssemblyresourcesIssues with component resources and using themIssues with component resources and using them