Open
Description
The following WIT world fails to compile with wit-bindgen==0.42.1
and the tool
feature not being active. This error comes after introducing the tool-error
variant and changing the return type of invoke-tool
to a result:
error: found a reference to a type which is excluded due to its feature not being activated
--> .../wit-unstable/skill.wit:27:39
|
27 | invoke-tool: func(request: u8) -> result<list<u8>, error>;
| ^-----
--> src/main.rs:3:1
|
3 | generate!({ path: "skill.wit", world: "skill" });
It appears like a bug, as only small changes to the WIT world (changing the unrelated type of output-schema
from a list<u8>
to a u8
) will lead to a successful compilation. My expectation would have been that it is possible to have unstable types in the signature of unstable functions.
package pharia:skill@0.3.0;
world skill {
import tool;
export skill-handler;
}
@since(version = 0.3.0)
interface skill-handler {
@since(version = 0.3.0)
record skill-metadata {
output-schema: list<u8>,
}
@since(version = 0.3.0)
metadata: func() -> skill-metadata;
}
interface tool {
@unstable(feature = tool)
variant error {
other(string)
}
@unstable(feature = tool)
invoke-tool: func(request: u8) -> result<list<u8>, error>;
}
A minimum reproducable example can be achieved with the following main:
use wit_bindgen::generate;
generate!({ path: "skill.wit", world: "skill" });
fn main() {
println!("Hello, world!");
}