From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- third_party/rust/uniffi/tests/ui/proc_macro_arc.rs | 24 ++++++++++++++++++++++ .../rust/uniffi/tests/ui/proc_macro_arc.stderr | 22 ++++++++++++++++++++ .../rust/uniffi/tests/ui/version_mismatch.rs | 4 ++++ .../rust/uniffi/tests/ui/version_mismatch.stderr | 7 +++++++ 4 files changed, 57 insertions(+) create mode 100644 third_party/rust/uniffi/tests/ui/proc_macro_arc.rs create mode 100644 third_party/rust/uniffi/tests/ui/proc_macro_arc.stderr create mode 100644 third_party/rust/uniffi/tests/ui/version_mismatch.rs create mode 100644 third_party/rust/uniffi/tests/ui/version_mismatch.stderr (limited to 'third_party/rust/uniffi/tests/ui') diff --git a/third_party/rust/uniffi/tests/ui/proc_macro_arc.rs b/third_party/rust/uniffi/tests/ui/proc_macro_arc.rs new file mode 100644 index 0000000000..9db3376594 --- /dev/null +++ b/third_party/rust/uniffi/tests/ui/proc_macro_arc.rs @@ -0,0 +1,24 @@ +use std::sync::Arc; + +fn main() {} + +// Normally this is defined by the scaffolding code, manually define it for the UI test +pub struct UniFfiTag; + +pub struct Foo; + +#[uniffi::export] +fn make_foo() -> Arc { + Arc::new(Foo) +} + +mod child { + use std::sync::Arc; + + enum Foo {} + + #[uniffi::export] + fn take_foo(foo: Arc) { + match &*foo {} + } +} diff --git a/third_party/rust/uniffi/tests/ui/proc_macro_arc.stderr b/third_party/rust/uniffi/tests/ui/proc_macro_arc.stderr new file mode 100644 index 0000000000..0654a29e25 --- /dev/null +++ b/third_party/rust/uniffi/tests/ui/proc_macro_arc.stderr @@ -0,0 +1,22 @@ +error[E0277]: the trait bound `Foo: FfiConverterArc` is not satisfied + --> tests/ui/proc_macro_arc.rs:10:1 + | +10 | #[uniffi::export] + | ^^^^^^^^^^^^^^^^^ the trait `FfiConverterArc` is not implemented for `Foo` + | + = help: the trait `LowerReturn` is implemented for `Arc` + = note: required for `Arc` to implement `FfiConverter` + = note: required for `Arc` to implement `Lower` + = note: required for `Arc` to implement `LowerReturn` + = note: this error originates in the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `child::Foo: FfiConverterArc` is not satisfied + --> tests/ui/proc_macro_arc.rs:20:5 + | +20 | #[uniffi::export] + | ^^^^^^^^^^^^^^^^^ the trait `FfiConverterArc` is not implemented for `child::Foo` + | + = help: the trait `Lift` is implemented for `Arc` + = note: required for `Arc` to implement `FfiConverter` + = note: required for `Arc` to implement `Lift` + = note: this error originates in the attribute macro `uniffi::export` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/third_party/rust/uniffi/tests/ui/version_mismatch.rs b/third_party/rust/uniffi/tests/ui/version_mismatch.rs new file mode 100644 index 0000000000..6a7edb891d --- /dev/null +++ b/third_party/rust/uniffi/tests/ui/version_mismatch.rs @@ -0,0 +1,4 @@ +// This should fail with a version mismatch. +uniffi::assert_compatible_version!("0.0.1"); // An error message would go here. + +fn main() {} diff --git a/third_party/rust/uniffi/tests/ui/version_mismatch.stderr b/third_party/rust/uniffi/tests/ui/version_mismatch.stderr new file mode 100644 index 0000000000..bc30714099 --- /dev/null +++ b/third_party/rust/uniffi/tests/ui/version_mismatch.stderr @@ -0,0 +1,7 @@ +error[E0080]: evaluation of constant value failed + --> tests/ui/version_mismatch.rs:2:1 + | +2 | uniffi::assert_compatible_version!("0.0.1"); // An error message would go here. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow + | + = note: this error originates in the macro `uniffi::deps::static_assertions::const_assert` which comes from the expansion of the macro `uniffi::assert_compatible_version` (in Nightly builds, run with -Z macro-backtrace for more info) -- cgit v1.2.3