File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -179,20 +179,22 @@ mod tests {
179179
180180 #[ test]
181181 fn test_memory_leak ( ) {
182- let mut ptr = null_mut ( ) ;
182+ Embed :: run ( || {
183+ let mut ptr = null_mut ( ) ;
183184
184- let _ = try_catch ( || {
185- let mut result = "foo" . to_string ( ) ;
186- ptr = & mut result;
185+ let _ = try_catch ( || {
186+ let mut result = "foo" . to_string ( ) ;
187+ ptr = & mut result;
187188
188- unsafe {
189- bailout ( ) ;
190- }
191- } ) ;
189+ unsafe {
190+ bailout ( ) ;
191+ }
192+ } ) ;
192193
193- // Check that the string is never released
194- let result = unsafe { & * ptr as & str } ;
194+ // Check that the string is never released
195+ let result = unsafe { & * ptr as & str } ;
195196
196- assert_eq ! ( result, "foo" ) ;
197+ assert_eq ! ( result, "foo" ) ;
198+ } ) ;
197199 }
198200}
You can’t perform that action at this time.
0 commit comments