Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully qualify uses of
Result
in scaffolding/macro code
PR mozilla#1469 introduced an incompatibility with a local `type Result<T> = std::result::Result<T, MyError>` type alias. As can be seen with the included test without the fix applied: ``` error[E0107]: this type alias takes 1 generic argument but 2 generic arguments were supplied --> /mounted_workdir/target/debug/build/unary-result-alias-f408c03f1955dadd/out/unary-result-alias.uniffi.rs:79:1 | 79 | / #[::uniffi::ffi_converter_error( 80 | | tag = crate::UniFfiTag, 81 | | flat_error, 82 | | 83 | | )] | | ^ | | | | |__expected 1 generic argument | help: remove this generic argument | note: type alias defined here, with 1 generic parameter: `T` --> fixtures/regressions/unary-result-alias/src/lib.rs:7:10 | 7 | pub type Result<T> = std::result::Result<T, MyError>; | ^^^^^^ - = note: this error originates in the macro `::uniffi::ffi_converter_default_return` which comes from the expansion of the attribute macro `::uniffi::ffi_converter_error` (in Nightly builds, run with -Z macro-backtrace for more info) ``` Fixing the macros in `uniffi_core` to use `::std::result::Result` fixes that. This exposes a further case in the generated code: ``` error[E0107]: this type alias takes 1 generic argument but 2 generic arguments were supplied --> /mounted_workdir/target/debug/build/unary-result-alias-f408c03f1955dadd/out/unary-result-alias.uniffi.rs:108:40 | 108 | uniffi::rust_call(call_status, || <Result<(), r#MyError> as ::uniffi::FfiConverter<crate::UniFfiTag>>::lower_return( | ^^^^^^ --------- help: remove this generic argument | | | expected 1 generic argument | note: type alias defined here, with 1 generic parameter: `T` --> fixtures/regressions/unary-result-alias/src/lib.rs:7:10 | 7 | pub type Result<T> = std::result::Result<T, MyError>; | ^^^^^^ - ``` So the same change is required to the output produced by bindgen.
- Loading branch information