Minor improvements (#414)

pull/413/head
Eva Pace 1 year ago committed by GitHub
parent c369e4b489
commit 302b995bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,7 +76,7 @@ For instance, say we convince the compiler to emit this logic:
```text ```text
initial state: x = 0, y = 1 initial state: x = 0, y = 1
THREAD 1 THREAD2 THREAD 1 THREAD 2
y = 3; if x == 1 { y = 3; if x == 1 {
x = 1; y *= 2; x = 1; y *= 2;
} }

@ -161,9 +161,9 @@ impl<'a, T> Hole<'a, T> {
unsafe { unsafe {
let elt = ptr::read(&data[pos]); let elt = ptr::read(&data[pos]);
Hole { Hole {
data: data, data,
elt: Some(elt), elt: Some(elt),
pos: pos, pos,
} }
} }
} }

@ -134,10 +134,10 @@ impl<T> Rc<T> {
// Wouldn't it be nice if heap::allocate worked like this? // Wouldn't it be nice if heap::allocate worked like this?
let ptr = heap::allocate::<RcBox<T>>(); let ptr = heap::allocate::<RcBox<T>>();
ptr::write(ptr, RcBox { ptr::write(ptr, RcBox {
data: data, data,
ref_count: 1, ref_count: 1,
}); });
Rc { ptr: ptr } Rc { ptr }
} }
} }
@ -194,7 +194,7 @@ pub fn scoped<'a, F>(f: F) -> JoinGuard<'a>
``` ```
Here `f` is some closure for the other thread to execute. Saying that Here `f` is some closure for the other thread to execute. Saying that
`F: Send +'a` is saying that it closes over data that lives for `'a`, and it `F: Send + 'a` is saying that it closes over data that lives for `'a`, and it
either owns that data or the data was Sync (implying `&data` is Send). either owns that data or the data was Sync (implying `&data` is Send).
Because JoinGuard has a lifetime, it keeps all the data it closes over Because JoinGuard has a lifetime, it keeps all the data it closes over

@ -23,7 +23,7 @@ impl<T> RawVec<T> {
// `NonNull::dangling()` doubles as "unallocated" and "zero-sized allocation" // `NonNull::dangling()` doubles as "unallocated" and "zero-sized allocation"
RawVec { RawVec {
ptr: NonNull::dangling(), ptr: NonNull::dangling(),
cap: cap, cap,
} }
} }

@ -39,7 +39,7 @@ impl<T> RawVec<T> {
// `NonNull::dangling()` doubles as "unallocated" and "zero-sized allocation" // `NonNull::dangling()` doubles as "unallocated" and "zero-sized allocation"
RawVec { RawVec {
ptr: NonNull::dangling(), ptr: NonNull::dangling(),
cap: cap, cap,
} }
} }

Loading…
Cancel
Save