File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
tests/runtime/resource-borrow Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2735,7 +2735,7 @@ impl<'a> {camel}Borrow<'a>{{
27352735 }}
27362736
27372737 /// Gets access to the underlying `T` in this resource.
2738- pub fn get<T: Guest{camel}>(&self) -> &T {{
2738+ pub fn get<T: Guest{camel}>(&self) -> &'a T {{
27392739 let ptr = unsafe {{ &mut *self.as_ptr::<T>() }};
27402740 ptr.as_ref().unwrap()
27412741 }}
Original file line number Diff line number Diff line change @@ -10,11 +10,15 @@ pub struct MyThing {
1010 val : u32 ,
1111}
1212
13+ fn get_val < ' a > ( v : & ThingBorrow < ' a > ) -> & ' a u32 {
14+ & v. get :: < MyThing > ( ) . val
15+ }
16+
1317impl Guest for Test {
1418 type Thing = MyThing ;
1519
1620 fn foo ( v : ThingBorrow < ' _ > ) -> u32 {
17- v . get :: < MyThing > ( ) . val + 2
21+ get_val ( & v ) + 2
1822 }
1923}
2024
You can’t perform that action at this time.
0 commit comments