mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
auto merge of #10575 : sfackler/rust/non-copyable, r=huonw
The issue that required it has been fixed.
This commit is contained in:
commit
6a25ba374b
@ -326,7 +326,7 @@ impl Sem<~[WaitQueue]> {
|
||||
// and rwlock_write_mode.
|
||||
pub fn access_cond<U>(&self, blk: |c: &Condvar| -> U) -> U {
|
||||
do self.access {
|
||||
blk(&Condvar { sem: self, order: Nothing, token: NonCopyable::new() })
|
||||
blk(&Condvar { sem: self, order: Nothing, token: NonCopyable })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -569,7 +569,7 @@ impl RWLock {
|
||||
do task::rekillable {
|
||||
let opt_lock = Just(&self.order_lock);
|
||||
blk(&Condvar { sem: cond.sem, order: opt_lock,
|
||||
token: NonCopyable::new() })
|
||||
token: NonCopyable })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -605,7 +605,7 @@ impl RWLock {
|
||||
(&self.order_lock).release();
|
||||
do (|| {
|
||||
do task::rekillable {
|
||||
blk(RWLockWriteMode { lock: self, token: NonCopyable::new() })
|
||||
blk(RWLockWriteMode { lock: self, token: NonCopyable })
|
||||
}
|
||||
}).finally {
|
||||
let writer_or_last_reader;
|
||||
@ -662,7 +662,7 @@ impl RWLock {
|
||||
}
|
||||
}
|
||||
}
|
||||
RWLockReadMode { lock: token.lock, token: NonCopyable::new() }
|
||||
RWLockReadMode { lock: token.lock, token: NonCopyable }
|
||||
}
|
||||
}
|
||||
|
||||
@ -682,7 +682,7 @@ impl<'self> RWLockWriteMode<'self> {
|
||||
// access lock. See comment in RWLock::write_cond for why.
|
||||
blk(&Condvar { sem: &self.lock.access_lock,
|
||||
order: Just(&self.lock.order_lock),
|
||||
token: NonCopyable::new() })
|
||||
token: NonCopyable })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,12 +62,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
|
||||
#[unsafe_no_drop_flag]
|
||||
pub struct NonCopyable;
|
||||
|
||||
impl NonCopyable {
|
||||
// FIXME(#8233) should not be necessary
|
||||
/// Create a new noncopyable token.
|
||||
pub fn new() -> NonCopyable { NonCopyable }
|
||||
}
|
||||
|
||||
impl Drop for NonCopyable {
|
||||
fn drop(&mut self) { }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user