Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5a446c1
Fix `window.hashchange is not a function`
fmckeogh Aug 21, 2019
b2b9b81
Account for doc comments coming from proc macros without spans
estebank Aug 27, 2019
7ed542d
add regression test
estebank Aug 27, 2019
3c4d157
Fix unlock ordering in SGX synchronization primitives
Aug 31, 2019
5e933b4
Add x86_64-linux-kernel target
alex Aug 31, 2019
35c9e5f
Fix const_err with `-(-0.0)`
JohnTitor Sep 1, 2019
3a6aada
Add `opt-level` check
JohnTitor Sep 1, 2019
4a0872b
Add `overflow_check` check
JohnTitor Sep 1, 2019
8e9825a
Fix overflow_check
JohnTitor Sep 1, 2019
0cd9c16
Fix condition and tests' flags
JohnTitor Sep 1, 2019
a937d8c
Fix tests again
JohnTitor Sep 1, 2019
334d465
Point at appropriate arm on type error on if/else/match with one non-…
estebank Sep 2, 2019
dd870d7
fix typo
estebank Sep 2, 2019
46877e2
Fix const eval bug breaking run-pass tests in Miri
wesleywiser Aug 29, 2019
c430d74
Add match test cases
estebank Sep 3, 2019
fa893a3
use TokenStream rather than &[TokenTree] for built-in macros
matklad Aug 31, 2019
6136495
use consistent naming for buildin expansion functions
matklad Sep 3, 2019
41deb83
Add compile flag
JohnTitor Sep 4, 2019
a0c186c
remove XID and Pattern_White_Space unicode tables from libcore
matklad Jul 21, 2019
206fe8e
flatten rustc_lexer::character_properties module
matklad Sep 4, 2019
c86ea34
Ensure all warnings are emitted even on warnings=warn
Mark-Simulacrum Sep 2, 2019
fda251b
Rename --warnings=allow to --warnings=warn
Mark-Simulacrum Sep 2, 2019
669c3e3
Thread in-tree information through Mode
Mark-Simulacrum Sep 4, 2019
a2384cb
Move warnings out of rustc wrapper
Mark-Simulacrum Sep 4, 2019
9483db5
Opaque type locations in error message for clarity.
gilescope Sep 4, 2019
4c268ca
Rollup merge of #62848 - matklad:xid-unicode, r=petrochenkov
Centril Sep 5, 2019
e56fe69
Rollup merge of #63774 - chocol4te:fix_63707, r=GuillaumeGomez
Centril Sep 5, 2019
bdcc539
Rollup merge of #63930 - estebank:rustdoc-ice, r=GuillaumeGomez
Centril Sep 5, 2019
32cff1b
Rollup merge of #64030 - jethrogb:jb/sgx-sync-issues, r=alexcrichton
Centril Sep 5, 2019
437e98f
Rollup merge of #64041 - matklad:token-stream-tt, r=petrochenkov
Centril Sep 5, 2019
05c6868
Rollup merge of #64051 - alex:linux-kernel-module-target, r=joshtriplett
Centril Sep 5, 2019
49bc3f5
Rollup merge of #64063 - JohnTitor:fix-const-err, r=oli-obk
Centril Sep 5, 2019
1893c61
Rollup merge of #64083 - estebank:tweak-e0308, r=oli-obk
Centril Sep 5, 2019
4f27dd2
Rollup merge of #64098 - Mark-Simulacrum:always-warn, r=alexcrichton
Centril Sep 5, 2019
15aeb27
Rollup merge of #64100 - wesleywiser:fix_miri_const_eval, r=oli-obk
Centril Sep 5, 2019
44a6e39
Rollup merge of #64157 - gilescope:opaque-type-location, r=cramertj,C…
Centril Sep 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/libstd/sys/sgx/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ impl Condvar {

pub unsafe fn wait(&self, mutex: &Mutex) {
let guard = self.inner.lock();
mutex.unlock();
WaitQueue::wait(guard);
WaitQueue::wait(guard, || mutex.unlock());
mutex.lock()
}

Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/sgx/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Mutex {
let mut guard = self.inner.lock();
if *guard.lock_var() {
// Another thread has the lock, wait
WaitQueue::wait(guard)
WaitQueue::wait(guard, ||{})
// Another thread has passed the lock to us
} else {
// We are just now obtaining the lock
Expand Down Expand Up @@ -83,7 +83,7 @@ impl ReentrantMutex {
match guard.lock_var().owner {
Some(tcs) if tcs != thread::current() => {
// Another thread has the lock, wait
WaitQueue::wait(guard);
WaitQueue::wait(guard, ||{});
// Another thread has passed the lock to us
},
_ => {
Expand Down
34 changes: 20 additions & 14 deletions src/libstd/sys/sgx/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl RWLock {
if *wguard.lock_var() || !wguard.queue_empty() {
// Another thread has or is waiting for the write lock, wait
drop(wguard);
WaitQueue::wait(rguard);
WaitQueue::wait(rguard, ||{});
// Another thread has passed the lock to us
} else {
// No waiting writers, acquire the read lock
Expand Down Expand Up @@ -62,7 +62,7 @@ impl RWLock {
if *wguard.lock_var() || rguard.lock_var().is_some() {
// Another thread has the lock, wait
drop(rguard);
WaitQueue::wait(wguard);
WaitQueue::wait(wguard, ||{});
// Another thread has passed the lock to us
} else {
// We are just now obtaining the lock
Expand Down Expand Up @@ -97,6 +97,7 @@ impl RWLock {
if let Ok(mut wguard) = WaitQueue::notify_one(wguard) {
// A writer was waiting, pass the lock
*wguard.lock_var_mut() = true;
wguard.drop_after(rguard);
} else {
// No writers were waiting, the lock is released
rtassert!(rguard.queue_empty());
Expand All @@ -117,21 +118,26 @@ impl RWLock {
rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
) {
if let Err(mut wguard) = WaitQueue::notify_one(wguard) {
// No writers waiting, release the write lock
*wguard.lock_var_mut() = false;
if let Ok(mut rguard) = WaitQueue::notify_all(rguard) {
// One or more readers were waiting, pass the lock to them
if let NotifiedTcs::All { count } = rguard.notified_tcs() {
*rguard.lock_var_mut() = Some(count)
match WaitQueue::notify_one(wguard) {
Err(mut wguard) => {
// No writers waiting, release the write lock
*wguard.lock_var_mut() = false;
if let Ok(mut rguard) = WaitQueue::notify_all(rguard) {
// One or more readers were waiting, pass the lock to them
if let NotifiedTcs::All { count } = rguard.notified_tcs() {
*rguard.lock_var_mut() = Some(count)
} else {
unreachable!() // called notify_all
}
rguard.drop_after(wguard);
} else {
unreachable!() // called notify_all
// No readers waiting, the lock is released
}
} else {
// No readers waiting, the lock is released
},
Ok(wguard) => {
// There was a thread waiting for write, just pass the lock
wguard.drop_after(rguard);
}
} else {
// There was a thread waiting for write, just pass the lock
}
}

Expand Down
11 changes: 9 additions & 2 deletions src/libstd/sys/sgx/waitqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ impl<'a, T> WaitGuard<'a, T> {
pub fn notified_tcs(&self) -> NotifiedTcs {
self.notified_tcs
}

/// Drop this `WaitGuard`, after dropping another `guard`.
pub fn drop_after<U>(self, guard: U) {
drop(guard);
drop(self);
}
}

impl<'a, T> Deref for WaitGuard<'a, T> {
Expand Down Expand Up @@ -140,7 +146,7 @@ impl WaitQueue {
/// until a wakeup event.
///
/// This function does not return until this thread has been awoken.
pub fn wait<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>) {
pub fn wait<T, F: FnOnce()>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>, before_wait: F) {
// very unsafe: check requirements of UnsafeList::push
unsafe {
let mut entry = UnsafeListEntry::new(SpinMutex::new(WaitEntry {
Expand All @@ -149,6 +155,7 @@ impl WaitQueue {
}));
let entry = guard.queue.inner.push(&mut entry);
drop(guard);
before_wait();
while !entry.lock().wake {
// don't panic, this would invalidate `entry` during unwinding
let eventset = rtunwrap!(Ok, usercalls::wait(EV_UNPARK, WAIT_INDEFINITE));
Expand Down Expand Up @@ -545,7 +552,7 @@ mod tests {
assert!(WaitQueue::notify_one(wq2.lock()).is_ok());
});

WaitQueue::wait(locked);
WaitQueue::wait(locked, ||{});

t1.join().unwrap();
}
Expand Down