diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /third_party/rust/uniffi/tests | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/uniffi/tests')
4 files changed, 58 insertions, 0 deletions
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..bdffc020e0 --- /dev/null +++ b/third_party/rust/uniffi/tests/ui/proc_macro_arc.rs @@ -0,0 +1,25 @@ +use std::sync::Arc; + +fn main() {} + +pub struct Foo; + +#[uniffi::export] +fn make_foo() -> Arc<Foo> { + Arc::new(Foo) +} + +mod child { + use std::sync::Arc; + + enum Foo {} + + #[uniffi::export] + fn take_foo(foo: Arc<Foo>) { + match &*foo {} + } +} + +mod uniffi_types { + pub use super::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..8bddbc1493 --- /dev/null +++ b/third_party/rust/uniffi/tests/ui/proc_macro_arc.stderr @@ -0,0 +1,22 @@ +error[E0271]: type mismatch resolving `<Arc<child::Foo> as child::_::_::{closure#0}::TypeEq>::This == Arc<Foo>` + --> tests/ui/proc_macro_arc.rs:18:22 + | +18 | fn take_foo(foo: Arc<Foo>) { + | ^^^ type mismatch resolving `<Arc<child::Foo> as child::_::_::{closure#0}::TypeEq>::This == Arc<Foo>` + | +note: expected this to be `Arc<Foo>` + --> tests/ui/proc_macro_arc.rs:18:22 + | +18 | fn take_foo(foo: Arc<Foo>) { + | ^^^ + = note: expected struct `Arc<Foo>` + found struct `Arc<child::Foo>` +note: required by a bound in `child::_::_::{closure#0}::assert_type_eq_all` + --> tests/ui/proc_macro_arc.rs:18:22 + | +18 | fn take_foo(foo: Arc<Foo>) { + | ^^^ + | | + | required by a bound in this + | required by this bound in `child::_::_::{closure#0}::assert_type_eq_all` + = note: this error originates in the macro `::uniffi::deps::static_assertions::assert_type_eq_all` (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..dde4a7a040 --- /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` (in Nightly builds, run with -Z macro-backtrace for more info) |