@@ -226,7 +226,7 @@ impl ResourceTables<'_> {
226226 match self . table_for_index ( & index) . remove_resource ( index) ? {
227227 RemovedResource :: Own { rep } => Ok ( Some ( rep) ) ,
228228 RemovedResource :: Borrow { scope } => {
229- self . task_state . call_context ( scope) . borrow_count -= 1 ;
229+ self . task_state . call_context ( scope) ? . borrow_count -= 1 ;
230230 Ok ( None )
231231 }
232232 }
@@ -273,8 +273,8 @@ impl ResourceTables<'_> {
273273 pub fn resource_lift_borrow ( & mut self , index : TypedResourceIndex ) -> Result < u32 > {
274274 let ( rep, is_own) = self . table_for_index ( & index) . resource_lend ( index) ?;
275275 if is_own {
276- let scope = self . task_state . current_call_context_scope_id ( ) ;
277- self . task_state . call_context ( scope) . lenders . push ( index) ;
276+ let scope = self . task_state . current_call_context_scope_id ( ) ? ;
277+ self . task_state . call_context ( scope) ? . lenders . push ( index) ;
278278 }
279279 Ok ( rep)
280280 }
@@ -292,8 +292,8 @@ impl ResourceTables<'_> {
292292 /// `VMComponentContext` which handles the special case of avoiding borrow
293293 /// tracking entirely.
294294 pub fn resource_lower_borrow ( & mut self , resource : TypedResource ) -> Result < u32 > {
295- let scope = self . task_state . current_call_context_scope_id ( ) ;
296- let cx = self . task_state . call_context ( scope) ;
295+ let scope = self . task_state . current_call_context_scope_id ( ) ? ;
296+ let cx = self . task_state . call_context ( scope) ? ;
297297 cx. borrow_count = cx. borrow_count . checked_add ( 1 ) . unwrap ( ) ;
298298 self . table_for_resource ( & resource)
299299 . resource_borrow_insert ( resource, scope)
@@ -306,8 +306,8 @@ impl ResourceTables<'_> {
306306 /// resources that were originally passed in.
307307 #[ inline]
308308 pub fn validate_scope_exit ( & mut self ) -> Result < ( ) > {
309- let current = self . task_state . current_call_context_scope_id ( ) ;
310- let cx = self . task_state . call_context ( current) ;
309+ let current = self . task_state . current_call_context_scope_id ( ) ? ;
310+ let cx = self . task_state . call_context ( current) ? ;
311311 if cx. borrow_count > 0 {
312312 bail ! ( "borrow handles still remain at the end of the call" )
313313 }
0 commit comments