TL;DR: prefix await
is better because it is consistent with the rest of the language despite of its drawbacks.
There's ongoing discussion whether prefix or postfix await
expression should be added to Rust.
WARNING: ThreadSanitizer: data race (pid=28298) | |
Read of size 8 at 0x7b2000009030 by thread T32: | |
#0 _$LT$futures_channel..mpsc..queue..Queue$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h6ca263cc39fadd8c queue.rs:172 (mpsc-22c621302f3d0cb3:x86_64+0x100038970) | |
#1 core::ptr::drop_in_place::h2deddc3643535d3f ptr.rs:194 (mpsc-22c621302f3d0cb3:x86_64+0x10001f8a8) | |
#2 core::ptr::drop_in_place::hb8c0f16a42964511 ptr.rs:194 (mpsc-22c621302f3d0cb3:x86_64+0x10002306c) | |
#3 _$LT$alloc..sync..Arc$LT$T$GT$$GT$::drop_slow::h79802a659643aa5c sync.rs:541 (mpsc-22c621302f3d0cb3:x86_64+0x100086670) | |
#4 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::ha9c0b5652212e54d sync.rs:994 (mpsc-22c621302f3d0cb3:x86_64+0x100087c6f) | |
#5 core::ptr::drop_in_place::hb76255f19666d440 ptr.rs:194 (mpsc-22c621302f3d0cb3:x86_64+0x100023018) | |
#6 core::ptr::drop_in_place::h2041ea1c39dc0817 ptr.rs:194 (mpsc-22c621302f3d0cb3:x86_64+0x10001ef5a) | |
#7 mpsc::send_one_two_three::_$u7b$$u7b$closu |
#!/usr/bin/env python | |
from __future__ import print_function | |
import time | |
s = "" | |
def f(): | |
global s | |
s += "a" |
use std::mem; | |
#[derive(Copy, Clone, Eq, PartialEq, Debug)] | |
struct Walk { | |
axis: u32, | |
positive: bool, | |
} | |
#[derive(Debug, Copy, Clone)] | |
struct Coord { |
use std::mem; | |
use std::pin::Pin; | |
use std::ops::DerefMut; | |
/// Self-referential struct | |
struct SelfRef<A, B> | |
where B: ?Sized, A: DerefMut, A::Target: Unpin, | |
{ | |
/// Holds a pointer of type A |
#[test] | |
fn test_bool_1() { | |
do_conformance_test("tests/rust-testcases/bool.sky", "# Boolean tests\n\nTrue + 9223372036854775807 ### Type of parameters mismatch\n") | |
} | |
#[test] | |
fn test_struct_1() { | |
do_conformance_test("tests/rust-testcases/struct.sky", "# Struct tests\n\n# Comparison\nassert_(struct() == struct())\nassert_(struct(a=1) == struct(a=1))\nassert_(struct(a=1, b=False) == struct(a=1, b=False))\n\n# Order of fields is not important for comparison\nassert_(struct(a=1, b=2) == struct(b=2, a=1))\n\n# Inequality\nassert_(struct(a=2) != struct())\nassert_(struct() != struct(a=2))\nassert_(struct(a=2) != struct(a=1))\nassert_(struct(a=2) != struct(b=1))\nassert_(struct(a=1, b=2) != struct(a=1, b=\"2\"))\n") | |
} |
#!/usr/bin/env python3 | |
from z3 import * | |
Person = Datatype("Person") | |
Person.declare("knight") | |
Person.declare("knave") | |
Person.declare("joker") | |
Person = Person.create() |
diff --git a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java | |
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java | |
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java | |
@@ -1115,19 +1115,21 @@ | |
} | |
} | |
- static String[] INDENTS = new String[0]; | |
+ static volatile String[] INDENTS = new String[0]; | |
//! `singleton::<T>()` creates `T` once, and returns | |
//! a pointer to the same instances on subsequent calls. | |
#![feature(alloc_static)] | |
use std::ptr; | |
use std::sync::atomic::*; | |
use std::cell::UnsafeCell; | |
/// The function |
//! Sample `lazy_static` function which provides an utility | |
//! similar to [lazy_static crate](https://github.com/rust-lang-nursery/lazy-static.rs) | |
//! but without any macros. | |
#![feature(alloc_static)] | |
use std::ptr; | |
use std::collections::HashMap; | |
use std::sync::atomic::*; | |
use std::cell::UnsafeCell; |