forked from mozilla/uniffi-rs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked UDL-based scaffolding generation so that it forwards the work to the proc-macro code. This means that almost all scaffolding generation now flows through the proc-macros and we no longer need to keep 2 implementations of it. The only major thing left is built-in traits. The scaffolding templates now generate stub interfaces and wrap them with a `[uniffi::export_for_udl]` macro. - Added proc-macro support for several features: - [ByArc] in callback interfaces - [ByRef] arguments in any position and for any type. - Handling custom type conversion errors like we do with UDL. If the custom type error is the same as the Err side of the result, we should throw in the foreign code rather than something like UnexpectedPanic. - Moved all keywords into a single module. - Renamed the existing macros that did similar work to `derive_[thing]_for_udl`. - Added the `LiftRef` trait. I'm hoping that this can be the start of defining smaller traits for particular purposes rather than using `FfiConverter` for everything. - Require that proc-macro error types implement Error + Send + Sync + 'static like the UDL ones do. Fixed a bunch of unit tests where this wasn't true.
- Loading branch information
Showing
42 changed files
with
726 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
fixtures/uitests/tests/ui/fieldless_errors_used_in_callbacks_cant_have_fields.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
error[E0533]: expected value, found struct variant `Self::DivisionByZero` | ||
--> $OUT_DIR[uniffi_uitests]/errors.uniffi.rs | ||
| | ||
| / #[::uniffi::ffi_converter_error( | ||
| | tag = crate::UniFfiTag, | ||
| / #[::uniffi::derive_error_for_udl( | ||
| | flat_error, | ||
| | with_try_read, | ||
| | handle_unknown_callback_error, | ||
| | )] | ||
| |__^ not a value | ||
| | ||
= note: this error originates in the attribute macro `::uniffi::ffi_converter_error` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
= note: this error originates in the attribute macro `::uniffi::derive_error_for_udl` (in Nightly builds, run with -Z macro-backtrace for more info) |
10 changes: 5 additions & 5 deletions
10
fixtures/uitests/tests/ui/interface_cannot_use_mut_self.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
error[E0308]: mismatched types | ||
error[E0596]: cannot borrow data in an `Arc` as mutable | ||
--> $OUT_DIR[uniffi_uitests]/counter.uniffi.rs | ||
| | ||
| Ok(ref val) => val, | ||
| ^^^ types differ in mutability | ||
| #[::uniffi::export_for_udl] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | ||
| | ||
= note: expected mutable reference `&mut Counter` | ||
found reference `&Arc<Counter>` | ||
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Arc<Counter>` | ||
= note: this error originates in the attribute macro `::uniffi::export_for_udl` (in Nightly builds, run with -Z macro-backtrace for more info) |
12 changes: 6 additions & 6 deletions
12
fixtures/uitests/tests/ui/interface_trait_not_sync_and_send.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.