summaryrefslogtreecommitdiffstats
path: root/third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap')
-rw-r--r--third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap45
1 files changed, 45 insertions, 0 deletions
diff --git a/third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap b/third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap
new file mode 100644
index 0000000000..f662608096
--- /dev/null
+++ b/third_party/rust/diplomat/src/snapshots/diplomat__tests__multilevel_borrows.snap
@@ -0,0 +1,45 @@
+---
+source: macro/src/lib.rs
+expression: "rustfmt_code(&gen_bridge(parse_quote! {\n mod ffi\n {\n #[diplomat :: opaque] struct Foo < 'a > (& 'a str) ;\n #[diplomat :: opaque] struct Bar < 'b, 'a : 'b >\n (& 'b Foo < 'a >) ; struct Baz < 'x, 'y >\n { foo : & 'y Foo < 'x >, } impl < 'a > Foo < 'a >\n {\n pub fn new(x : & 'a str) -> Box < Foo < 'a >>\n { unimplemented! () } pub fn get_bar < 'b > (& 'b self) ->\n Box < Bar < 'b, 'a >> { unimplemented! () } pub fn get_baz <\n 'b > (& 'b self) -> Baz < 'b, 'a > { Bax { foo : self } }\n }\n }\n }).to_token_stream().to_string())"
+---
+mod ffi {
+ struct Foo<'a>(&'a str);
+ struct Bar<'b, 'a: 'b>(&'b Foo<'a>);
+ #[repr(C)]
+ struct Baz<'x, 'y> {
+ foo: &'y Foo<'x>,
+ }
+ impl<'a> Foo<'a> {
+ pub fn new(x: &'a str) -> Box<Foo<'a>> {
+ unimplemented!()
+ }
+ pub fn get_bar<'b>(&'b self) -> Box<Bar<'b, 'a>> {
+ unimplemented!()
+ }
+ pub fn get_baz<'b>(&'b self) -> Baz<'b, 'a> {
+ Bax { foo: self }
+ }
+ }
+ #[no_mangle]
+ extern "C" fn Bar_destroy<'b, 'a: 'b>(this: Box<Bar<'b, 'a>>) {}
+ #[no_mangle]
+ extern "C" fn Baz_destroy<'x: 'y, 'y>(this: Box<Baz<'x, 'y>>) {}
+ #[no_mangle]
+ extern "C" fn Foo_new<'a>(x_diplomat_data: *const u8, x_diplomat_len: usize) -> Box<Foo<'a>> {
+ Foo::new(unsafe {
+ core::str::from_utf8(core::slice::from_raw_parts(x_diplomat_data, x_diplomat_len))
+ .unwrap()
+ })
+ }
+ #[no_mangle]
+ extern "C" fn Foo_get_bar<'a: 'b, 'b>(this: &'b Foo<'a>) -> Box<Bar<'b, 'a>> {
+ this.get_bar()
+ }
+ #[no_mangle]
+ extern "C" fn Foo_get_baz<'a: 'b, 'b>(this: &'b Foo<'a>) -> Baz<'b, 'a> {
+ this.get_baz()
+ }
+ #[no_mangle]
+ extern "C" fn Foo_destroy<'a>(this: Box<Foo<'a>>) {}
+}
+