We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59221e9 commit 54713afCopy full SHA for 54713af
src/libcore/task.rs
@@ -1283,3 +1283,23 @@ fn test_tls_overwrite_multiple_types() unsafe {
1283
local_data_set(int_key, @31337);
1284
}
1285
1286
+
1287
+#[test]
1288
+#[should_fail]
1289
+#[ignore(cfg(windows))]
1290
+fn test_tls_cleanup_on_failure() unsafe {
1291
+ fn str_key(+_x: @str) { }
1292
+ fn box_key(+_x: @@()) { }
1293
+ fn int_key(+_x: @int) { }
1294
+ local_data_set(str_key, @"parent data");
1295
+ local_data_set(box_key, @@());
1296
+ task::spawn{|| // spawn_linked
1297
+ local_data_set(str_key, @"string data");
1298
1299
+ local_data_set(int_key, @42);
1300
+ fail;
1301
+ }
1302
+ // Not quite nondeterministic.
1303
+ local_data_set(int_key, @31337);
1304
1305
+}
0 commit comments