зеркало из https://github.com/mozilla/gecko-dev.git
No bug - Revendor rust dependencies
This commit is contained in:
Родитель
a480d9ea0b
Коммит
97e5ebd02b
|
@ -1 +1 @@
|
|||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"16ab07cbd79a5419fc141dfdd40f072dfa975bf7abb644e810ca07a8b8de5382","Cargo.toml":"16bd10cad7d8d1b989495c512d0739f32b636b67aa1f7cdf8a87a489235e196d","LICENSE":"90bc15ed094593083fd129fdd1a03607be80fe8839c5564616a5961ab7f7a194","README.md":"dfa901cc27a4c47e8c0685aa83af78edf4928faabfb1982d8ff2382eca452d55","src/lib.rs":"765b9600440045e803b5a0946b7a78f8cdf998859bb8d46f6853fce42e67b211"},"package":"9d52571ddcb42e9c900c901a18d8d67e393df723fcd51dd59c5b1a85d0acb6cc"}
|
||||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"16ab07cbd79a5419fc141dfdd40f072dfa975bf7abb644e810ca07a8b8de5382","Cargo.toml":"d6033830eecd6112eb61e775f848ab6c7ee76822ee1d7f8786b34e6e71f45b7b","LICENSE":"90bc15ed094593083fd129fdd1a03607be80fe8839c5564616a5961ab7f7a194","README.md":"e18ff10a148a8316e89bbe9f45cb57657170abe1a19154f8a5c968d529fe895e","src/lib.rs":"5d8857eee0de9863c3b6fce98732427cc1868a5ec3f0e3ce652ec011391aa842"},"package":"cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"}
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "owning_ref"
|
||||
version = "0.2.4"
|
||||
version = "0.3.3"
|
||||
authors = ["Marvin Löbel <loebel.marvin@gmail.com>"]
|
||||
license = "MIT"
|
||||
|
||||
|
@ -10,3 +10,6 @@ documentation = "http://kimundi.github.io/owning-ref-rs/owning_ref/index.html"
|
|||
|
||||
repository = "https://github.com/Kimundi/owning-ref-rs"
|
||||
keywords = ["reference", "sibling", "field", "owning"]
|
||||
|
||||
[dependencies]
|
||||
stable_deref_trait = "1.0.0"
|
||||
|
|
|
@ -1,29 +1,49 @@
|
|||
owning-ref-rs
|
||||
==============
|
||||
|
||||
[![Travis-CI Status](https://travis-ci.org/Kimundi/owning-ref-rs.png?branch=master)](https://travis-ci.org/Kimundi/owning-ref-rs)
|
||||
|
||||
A library for creating references that carry their owner with them.
|
||||
|
||||
For more details, see the [docs](http://kimundi.github.io/owning-ref-rs/owning_ref/index.html).
|
||||
This can sometimes be useful because Rust borrowing rules normally prevent
|
||||
moving a type that has been moved from. For example, this kind of code gets rejected:
|
||||
|
||||
```rust
|
||||
fn return_owned_and_referenced<'a>() -> (Vec<u8>, &'a [u8]) {
|
||||
let v = vec![1, 2, 3, 4];
|
||||
let s = &v[1..3];
|
||||
(v, s)
|
||||
}
|
||||
```
|
||||
|
||||
This library enables this safe usage by keeping the owner and the reference
|
||||
bundled together in a wrapper type that ensure that lifetime constraint:
|
||||
|
||||
```rust
|
||||
fn return_owned_and_referenced() -> OwningRef<Vec<u8>, [u8]> {
|
||||
let v = vec![1, 2, 3, 4];
|
||||
let or = OwningRef::new(v);
|
||||
let or = or.map(|v| &v[1..3]);
|
||||
or
|
||||
}
|
||||
```
|
||||
|
||||
[![Travis-CI Status](https://travis-ci.org/Kimundi/owning-ref-rs.png?branch=master)](https://travis-ci.org/Kimundi/owning-ref-rs)
|
||||
|
||||
# Getting Started
|
||||
|
||||
[owning-ref-rs is available on crates.io](https://crates.io/crates/owning_ref).
|
||||
Add the following dependency to your Cargo manifest to get the latest version of the 0.2 branch:
|
||||
It is recommended to look there for the newest released version, as well as links to the newest builds of the docs.
|
||||
|
||||
At the point of the last update of this README, the latest published version could be used like this:
|
||||
|
||||
Add the following dependency to your Cargo manifest...
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
owning_ref = "0.2"
|
||||
owning_ref = "0.3"
|
||||
```
|
||||
|
||||
To always get the latest version, add this git repository to your
|
||||
Cargo manifest:
|
||||
...and see the [docs](http://kimundi.github.io/owning-ref-rs/owning_ref/index.html) for how to use it.
|
||||
|
||||
```toml
|
||||
[dependencies.owning_ref]
|
||||
git = "https://github.com/Kimundi/owning-ref-rs"
|
||||
```
|
||||
# Example
|
||||
|
||||
```rust
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1 +1 @@
|
|||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"9b39b9d42d077d028d5742450256c9f11f3456ff185ce2a987f4606b152bf440","Cargo.toml":"8a0938f1fd49ceae700f27333cdacd754d7b2205664265de4bd67be3d37a9525","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"d7bb9d24f29da05ef02c232f6354c01a93a8205f55d137f8b7d7a74f88163994","appveyor.yml":"1181ecde6a5df38051107a3ef4051751499f5a462ed761c1eafd6d4c62fde73e","src/condvar.rs":"227cd171d14ee54b115a5d1bff38ac4a01460ca2d85a40773b08035b6f39e94e","src/elision.rs":"0fef04d2991afeabafb041e81afeec74e89095d0eca49e5516bdcd5bc90c086f","src/lib.rs":"50951210148941266ce3a7d4017c339f8ad4419a9a8db6f915023890ed27d638","src/mutex.rs":"956b58465f78ac97d8ecf4dda7bbd973998cb29c4057f51cc3d8c8bdfa47f460","src/once.rs":"dee225c5472d152ed820eb90a3dcb96f7af409d8315f006b2179fa3f350de4ed","src/raw_mutex.rs":"225cbf0ef951be062866da674e5eea8245fcc43ecd8a26da7097dea03b770bf5","src/raw_remutex.rs":"a451cc3ce7bf11bc94777148b81d39b07b5a2a2fc698f6db2ca2fc765b158fa8","src/raw_rwlock.rs":"f7a206d0d401dae475d42f06d8a8fe6d8f2ca986b60633aaa4d3d588a997793e","src/remutex.rs":"a5cefa1a97e4669e3b2dffa9007988e6a6088500472d9eefea1a28ed1443e1b0","src/rwlock.rs":"3de0dded88f3dd339e962aba1cc778a03d5a10ac743325a81859617c455c31d3","src/stable.rs":"cc18c58404dc6017924d88fb9f4ed94e5320b8cb0a36985162b23130b8cd7480","src/util.rs":"2d07c0c010a857790ae2ed6a1215eeed8af76859e076797ea1ba8dec82169e84"},"package":"fa12d706797d42551663426a45e2db2e0364bd1dbf6aeada87e89c5f981f43e9"}
|
||||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"8e424960f1e47843f45cae205873e9590e4317b5b2316090f9f94cf2f5d704e8","Cargo.toml":"a31940ea072ae30f6df4c28f4fcbae206929a9e7e8adf19956dd9ed75fa7e75d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"0c248175303f7dc19ce2cb30882c950a55a49da6b8c765c5ba49feb3e6eb7553","appveyor.yml":"cc608360622923f6f693cd68b4d7c1f64daa55f6b38f0df90f270825c6c276bc","src/condvar.rs":"962a3838e95cb664b261a44f536b003a284fe7bfdcb94a80c9a07c7679cae3dd","src/elision.rs":"0fef04d2991afeabafb041e81afeec74e89095d0eca49e5516bdcd5bc90c086f","src/lib.rs":"50951210148941266ce3a7d4017c339f8ad4419a9a8db6f915023890ed27d638","src/mutex.rs":"59cd61dd8deeaacceabd05e15b7fd6d2942e3f6c3c592221898d84a2ca804a6e","src/once.rs":"eada2e82bd8dcb9ed68d4fb2d9f8c336878eeb122f0bf8dde3feb2d77adfb598","src/raw_mutex.rs":"225cbf0ef951be062866da674e5eea8245fcc43ecd8a26da7097dea03b770bf5","src/raw_remutex.rs":"6c6d2aa83abe8f45db04de0efc04c70564cd0c55b6655da8ef4afe841c0add95","src/raw_rwlock.rs":"a7aebf70b8f7a43f96136388be1a54e5ca5b565c9da623f23434c99fb4c0b147","src/remutex.rs":"7f1640fa5a6eb43b592db47d9afa63904895030d246708ec8eac413dc8093514","src/rwlock.rs":"87d648c5fcccda784da165801b888a3592b6a85ddb605c1df3ae0e881dd22417","src/stable.rs":"cc18c58404dc6017924d88fb9f4ed94e5320b8cb0a36985162b23130b8cd7480","src/util.rs":"2d07c0c010a857790ae2ed6a1215eeed8af76859e076797ea1ba8dec82169e84"},"package":"37f364e2ce5efa24c7d0b6646d5bb61145551a0112f107ffd7499f1a3e322fbd"}
|
|
@ -2,7 +2,7 @@ language: rust
|
|||
sudo: false
|
||||
|
||||
rust:
|
||||
- 1.9.0
|
||||
- 1.13.0
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
|
|
|
@ -1,24 +1,36 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "parking_lot"
|
||||
version = "0.3.8"
|
||||
version = "0.4.4"
|
||||
authors = ["Amanieu d'Antras <amanieu@gmail.com>"]
|
||||
description = "More compact and efficient implementations of the standard synchronization primitives."
|
||||
documentation = "https://amanieu.github.io/parking_lot/parking_lot/index.html"
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/Amanieu/parking_lot"
|
||||
readme = "README.md"
|
||||
keywords = ["mutex", "condvar", "rwlock", "once", "thread"]
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/Amanieu/parking_lot"
|
||||
[dependencies.owning_ref]
|
||||
version = "0.3"
|
||||
optional = true
|
||||
|
||||
[dependencies]
|
||||
parking_lot_core = { path = "core", version = "0.2" }
|
||||
owning_ref = { version = "0.2", optional = true }
|
||||
|
||||
[target.'cfg(not(target_os = "emscripten"))'.dependencies]
|
||||
thread-id = "3.0"
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.3"
|
||||
[dependencies.parking_lot_core]
|
||||
version = "0.2"
|
||||
[dev-dependencies.rand]
|
||||
version = "0.3"
|
||||
|
||||
[features]
|
||||
default = ["owning_ref"]
|
||||
nightly = ["parking_lot_core/nightly"]
|
||||
[target."cfg(not(target_os = \"emscripten\"))".dependencies.thread-id]
|
||||
version = "3.0"
|
||||
|
|
|
@ -68,12 +68,12 @@ in the Rust standard library:
|
|||
|
||||
To keep these primitives small, all thread queuing and suspending
|
||||
functionality is offloaded to the *parking lot*. The idea behind this is
|
||||
based on the Webkit [`WTF::ParkingLot`]
|
||||
(https://webkit.org/blog/6161/locking-in-webkit/) class, which essentially
|
||||
consists of a hash table mapping of lock addresses to queues of parked
|
||||
(sleeping) threads. The Webkit parking lot was itself inspired by Linux
|
||||
[futexes](http://man7.org/linux/man-pages/man2/futex.2.html), but it is more
|
||||
powerful since it allows invoking callbacks while holding a queue lock.
|
||||
based on the Webkit [`WTF::ParkingLot`](https://webkit.org/blog/6161/locking-in-webkit/)
|
||||
class, which essentially consists of a hash table mapping of lock addresses
|
||||
to queues of parked (sleeping) threads. The Webkit parking lot was itself
|
||||
inspired by Linux [futexes](http://man7.org/linux/man-pages/man2/futex.2.html),
|
||||
but it is more powerful since it allows invoking callbacks while holding a queue
|
||||
lock.
|
||||
|
||||
## Nightly vs stable
|
||||
|
||||
|
@ -93,7 +93,7 @@ Add this to your `Cargo.toml`:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
parking_lot = "0.3"
|
||||
parking_lot = "0.4"
|
||||
```
|
||||
|
||||
and this to your crate root:
|
||||
|
@ -106,7 +106,7 @@ To enable nightly-only features, add this to your `Cargo.toml` instead:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
parking_lot = {version = "0.3", features = ["nightly"]}
|
||||
parking_lot = {version = "0.4", features = ["nightly"]}
|
||||
```
|
||||
|
||||
The core parking lot API is provided by the `parking_lot_core` crate. It is
|
||||
|
|
|
@ -5,10 +5,10 @@ environment:
|
|||
- TARGET: nightly-i686-pc-windows-msvc
|
||||
- TARGET: nightly-x86_64-pc-windows-gnu
|
||||
- TARGET: nightly-i686-pc-windows-gnu
|
||||
- TARGET: 1.9.0-x86_64-pc-windows-msvc
|
||||
- TARGET: 1.9.0-i686-pc-windows-msvc
|
||||
- TARGET: 1.9.0-x86_64-pc-windows-gnu
|
||||
- TARGET: 1.9.0-i686-pc-windows-gnu
|
||||
- TARGET: 1.13.0-x86_64-pc-windows-msvc
|
||||
- TARGET: 1.13.0-i686-pc-windows-msvc
|
||||
- TARGET: 1.13.0-x86_64-pc-windows-gnu
|
||||
- TARGET: 1.13.0-i686-pc-windows-gnu
|
||||
|
||||
install:
|
||||
- SET PATH=C:\Python27;C:\Python27\Scripts;%PATH%;%APPDATA%\Python\Scripts
|
||||
|
|
|
@ -143,19 +143,19 @@ impl Condvar {
|
|||
#[inline]
|
||||
pub fn notify_all(&self) {
|
||||
// Nothing to do if there are no waiting threads
|
||||
if self.state.load(Ordering::Relaxed).is_null() {
|
||||
let state = self.state.load(Ordering::Relaxed);
|
||||
if state.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
self.notify_all_slow();
|
||||
self.notify_all_slow(state);
|
||||
}
|
||||
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
fn notify_all_slow(&self) {
|
||||
fn notify_all_slow(&self, mutex: *mut RawMutex) {
|
||||
unsafe {
|
||||
// Unpark one thread and requeue the rest onto the mutex
|
||||
let mutex = self.state.load(Ordering::Relaxed);
|
||||
let from = self as *const _ as usize;
|
||||
let to = mutex as usize;
|
||||
let validate = || {
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::cell::UnsafeCell;
|
|||
use std::ops::{Deref, DerefMut};
|
||||
use std::time::{Duration, Instant};
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::marker::PhantomData;
|
||||
use raw_mutex::RawMutex;
|
||||
|
||||
|
@ -300,6 +301,7 @@ impl<'a, T: ?Sized + 'a> MutexGuard<'a, T> {
|
|||
#[inline]
|
||||
pub fn unlock_fair(self) {
|
||||
self.mutex.raw.unlock(true);
|
||||
mem::forget(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,21 @@ const POISON_BIT: U8 = 2;
|
|||
const LOCKED_BIT: U8 = 4;
|
||||
const PARKED_BIT: U8 = 8;
|
||||
|
||||
/// State yielded to the `call_once_force` method which can be used to query
|
||||
/// whether the `Once` was previously poisoned or not.
|
||||
pub struct OnceState(bool);
|
||||
/// Current state of a `Once`.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum OnceState {
|
||||
/// A closure has not been executed yet
|
||||
New,
|
||||
|
||||
/// A closure was executed but panicked.
|
||||
Poisoned,
|
||||
|
||||
/// A thread is currently executing a closure.
|
||||
InProgress,
|
||||
|
||||
/// A closure has completed sucessfully.
|
||||
Done,
|
||||
}
|
||||
|
||||
impl OnceState {
|
||||
/// Returns whether the associated `Once` has been poisoned.
|
||||
|
@ -33,7 +45,20 @@ impl OnceState {
|
|||
/// indicate to future forced initialization routines that it is poisoned.
|
||||
#[inline]
|
||||
pub fn poisoned(&self) -> bool {
|
||||
self.0
|
||||
match *self {
|
||||
OnceState::Poisoned => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether the associated `Once` has successfullly executed a
|
||||
/// closure.
|
||||
#[inline]
|
||||
pub fn done(&self) -> bool {
|
||||
match *self {
|
||||
OnceState::Done => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,6 +105,21 @@ impl Once {
|
|||
Once(AtomicU8::new(0))
|
||||
}
|
||||
|
||||
/// Returns the current state of this `Once`.
|
||||
#[inline]
|
||||
pub fn state(&self) -> OnceState {
|
||||
let state = self.0.load(Ordering::Acquire);
|
||||
if state & DONE_BIT != 0 {
|
||||
OnceState::Done
|
||||
} else if state & LOCKED_BIT != 0 {
|
||||
OnceState::InProgress
|
||||
} else if state & POISON_BIT != 0 {
|
||||
OnceState::Poisoned
|
||||
} else {
|
||||
OnceState::New
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an initialization routine once and only once. The given closure
|
||||
/// will be executed if this is the first time `call_once` has been called,
|
||||
/// and otherwise the routine will *not* be invoked.
|
||||
|
@ -160,9 +200,7 @@ impl Once {
|
|||
|
||||
let mut f = Some(f);
|
||||
self.call_once_slow(true,
|
||||
&mut |state| unsafe {
|
||||
f.take().unchecked_unwrap()(state)
|
||||
});
|
||||
&mut |state| unsafe { f.take().unchecked_unwrap()(state) });
|
||||
}
|
||||
|
||||
// This is a non-generic function to reduce the monomorphization cost of
|
||||
|
@ -267,7 +305,12 @@ impl Once {
|
|||
// At this point we have the lock, so run the closure. Make sure we
|
||||
// properly clean up if the closure panicks.
|
||||
let guard = PanicGuard(self);
|
||||
f(OnceState(state & POISON_BIT != 0));
|
||||
let once_state = if state & POISON_BIT != 0 {
|
||||
OnceState::Poisoned
|
||||
} else {
|
||||
OnceState::New
|
||||
};
|
||||
f(once_state);
|
||||
mem::forget(guard);
|
||||
|
||||
// Now unlock the state, set the done bit and unpark all threads
|
||||
|
@ -348,15 +391,11 @@ mod tests {
|
|||
static O: Once = ONCE_INIT;
|
||||
|
||||
// poison the once
|
||||
let t = panic::catch_unwind(|| {
|
||||
O.call_once(|| panic!());
|
||||
});
|
||||
let t = panic::catch_unwind(|| { O.call_once(|| panic!()); });
|
||||
assert!(t.is_err());
|
||||
|
||||
// poisoning propagates
|
||||
let t = panic::catch_unwind(|| {
|
||||
O.call_once(|| {});
|
||||
});
|
||||
let t = panic::catch_unwind(|| { O.call_once(|| {}); });
|
||||
assert!(t.is_err());
|
||||
|
||||
// we can subvert poisoning, however
|
||||
|
@ -377,9 +416,7 @@ mod tests {
|
|||
static O: Once = ONCE_INIT;
|
||||
|
||||
// poison the once
|
||||
let t = panic::catch_unwind(|| {
|
||||
O.call_once(|| panic!());
|
||||
});
|
||||
let t = panic::catch_unwind(|| { O.call_once(|| panic!()); });
|
||||
assert!(t.is_err());
|
||||
|
||||
// make sure someone's waiting inside the once via a force
|
||||
|
@ -398,9 +435,7 @@ mod tests {
|
|||
// put another waiter on the once
|
||||
let t2 = thread::spawn(|| {
|
||||
let mut called = false;
|
||||
O.call_once(|| {
|
||||
called = true;
|
||||
});
|
||||
O.call_once(|| { called = true; });
|
||||
assert!(!called);
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ fn get_thread_id() -> usize {
|
|||
// reserved value to indicate an empty slot. We instead fall
|
||||
// back to using the address of a thread-local variable, which
|
||||
// is slightly slower but guaranteed to produce a non-zero value.
|
||||
thread_local!(static KEY: u8 = unsafe { std::mem::uninitialized() });
|
||||
thread_local!(static KEY: u8 = unsafe { ::std::mem::uninitialized() });
|
||||
KEY.with(|x| x as *const _ as usize)
|
||||
}
|
||||
|
||||
|
|
|
@ -101,14 +101,22 @@ impl RawRwLock {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn try_lock_shared_fast(&self) -> bool {
|
||||
fn try_lock_shared_fast(&self, recursive: bool) -> bool {
|
||||
let state = self.state.load(Ordering::Relaxed);
|
||||
|
||||
// Even if there are no exclusive locks, we can't allow grabbing a
|
||||
// shared lock while there are parked threads since that could lead to
|
||||
// writer starvation.
|
||||
if state & (LOCKED_BIT | PARKED_BIT) != 0 {
|
||||
return false;
|
||||
if !recursive {
|
||||
// Even if there are no exclusive locks, we can't allow grabbing a
|
||||
// shared lock while there are parked threads since that could lead to
|
||||
// writer starvation.
|
||||
if state & (LOCKED_BIT | PARKED_BIT) != 0 {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Allow acquiring a lock even if a thread is parked to avoid
|
||||
// deadlocks for recursive read locks.
|
||||
if state & LOCKED_BIT != 0 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Use hardware lock elision to avoid cache conflicts when multiple
|
||||
|
@ -126,34 +134,34 @@ impl RawRwLock {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn lock_shared(&self) {
|
||||
if !self.try_lock_shared_fast() {
|
||||
self.lock_shared_slow(None);
|
||||
pub fn lock_shared(&self, recursive: bool) {
|
||||
if !self.try_lock_shared_fast(recursive) {
|
||||
self.lock_shared_slow(recursive, None);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_lock_shared_until(&self, timeout: Instant) -> bool {
|
||||
if self.try_lock_shared_fast() {
|
||||
pub fn try_lock_shared_until(&self, recursive: bool, timeout: Instant) -> bool {
|
||||
if self.try_lock_shared_fast(recursive) {
|
||||
return true;
|
||||
}
|
||||
self.lock_shared_slow(Some(timeout))
|
||||
self.lock_shared_slow(recursive, Some(timeout))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_lock_shared_for(&self, timeout: Duration) -> bool {
|
||||
if self.try_lock_shared_fast() {
|
||||
pub fn try_lock_shared_for(&self, recursive: bool, timeout: Duration) -> bool {
|
||||
if self.try_lock_shared_fast(recursive) {
|
||||
return true;
|
||||
}
|
||||
self.lock_shared_slow(Some(Instant::now() + timeout))
|
||||
self.lock_shared_slow(recursive, Some(Instant::now() + timeout))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_lock_shared(&self) -> bool {
|
||||
if self.try_lock_shared_fast() {
|
||||
pub fn try_lock_shared(&self, recursive: bool) -> bool {
|
||||
if self.try_lock_shared_fast(recursive) {
|
||||
return true;
|
||||
}
|
||||
self.try_lock_shared_slow()
|
||||
self.try_lock_shared_slow(recursive)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -359,7 +367,7 @@ impl RawRwLock {
|
|||
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
fn lock_shared_slow(&self, timeout: Option<Instant>) -> bool {
|
||||
fn lock_shared_slow(&self, recursive: bool, timeout: Option<Instant>) -> bool {
|
||||
let mut spinwait = SpinWait::new();
|
||||
let mut spinwait_shared = SpinWait::new();
|
||||
let mut state = self.state.load(Ordering::Relaxed);
|
||||
|
@ -378,7 +386,7 @@ impl RawRwLock {
|
|||
// Grab the lock if there are no exclusive threads locked or
|
||||
// waiting. However if we were unparked then we are allowed to grab
|
||||
// the lock even if there are pending exclusive threads.
|
||||
if state & LOCKED_BIT == 0 && (unparked || state & PARKED_BIT == 0) {
|
||||
if state & LOCKED_BIT == 0 && (unparked || recursive || state & PARKED_BIT == 0) {
|
||||
let new = state.checked_add(SHARED_COUNT_INC)
|
||||
.expect("RwLock shared count overflow");
|
||||
if self.state
|
||||
|
@ -468,10 +476,15 @@ impl RawRwLock {
|
|||
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
pub fn try_lock_shared_slow(&self) -> bool {
|
||||
pub fn try_lock_shared_slow(&self, recursive: bool) -> bool {
|
||||
let mut state = self.state.load(Ordering::Relaxed);
|
||||
loop {
|
||||
if state & (LOCKED_BIT | PARKED_BIT) != 0 {
|
||||
let mask = if recursive {
|
||||
LOCKED_BIT
|
||||
} else {
|
||||
LOCKED_BIT | PARKED_BIT
|
||||
};
|
||||
if state & mask != 0 {
|
||||
return false;
|
||||
}
|
||||
if have_elision() && state == 0 {
|
||||
|
@ -546,15 +559,15 @@ impl RawRwLock {
|
|||
// unlocking. If we are then we should set the exclusive
|
||||
// locked bit and tell the thread that we are handing it
|
||||
// the lock directly.
|
||||
let token;
|
||||
if result.unparked_threads != 0 && new & SHARED_COUNT_MASK == 0 &&
|
||||
first_token.get().unchecked_unwrap() == TOKEN_EXCLUSIVE &&
|
||||
(force_fair || result.be_fair) {
|
||||
let token = if result.unparked_threads != 0 &&
|
||||
new & SHARED_COUNT_MASK == 0 &&
|
||||
first_token.get().unchecked_unwrap() == TOKEN_EXCLUSIVE &&
|
||||
(force_fair || result.be_fair) {
|
||||
new |= LOCKED_BIT;
|
||||
token = TOKEN_HANDOFF;
|
||||
TOKEN_HANDOFF
|
||||
} else {
|
||||
token = TOKEN_NORMAL;
|
||||
}
|
||||
TOKEN_NORMAL
|
||||
};
|
||||
|
||||
match self.state
|
||||
.compare_exchange_weak(state,
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::cell::UnsafeCell;
|
|||
use std::ops::Deref;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::marker::PhantomData;
|
||||
use raw_remutex::RawReentrantMutex;
|
||||
|
||||
|
@ -239,6 +240,7 @@ impl<'a, T: ?Sized + 'a> ReentrantMutexGuard<'a, T> {
|
|||
#[inline]
|
||||
pub fn unlock_fair(self) {
|
||||
self.mutex.raw.unlock(true);
|
||||
mem::forget(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,9 +310,11 @@ mod tests {
|
|||
let _lock = m.try_lock();
|
||||
let _lock2 = m.try_lock();
|
||||
thread::spawn(move || {
|
||||
let lock = m2.try_lock();
|
||||
assert!(lock.is_none());
|
||||
}).join().unwrap();
|
||||
let lock = m2.try_lock();
|
||||
assert!(lock.is_none());
|
||||
})
|
||||
.join()
|
||||
.unwrap();
|
||||
let _lock3 = m.try_lock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ impl<T: ?Sized> RwLock<T> {
|
|||
/// once it is dropped.
|
||||
#[inline]
|
||||
pub fn read(&self) -> RwLockReadGuard<T> {
|
||||
self.raw.lock_shared();
|
||||
self.raw.lock_shared(false);
|
||||
RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
|
@ -194,7 +194,7 @@ impl<T: ?Sized> RwLock<T> {
|
|||
/// This function does not block.
|
||||
#[inline]
|
||||
pub fn try_read(&self) -> Option<RwLockReadGuard<T>> {
|
||||
if self.raw.try_lock_shared() {
|
||||
if self.raw.try_lock_shared(false) {
|
||||
Some(RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
|
@ -212,7 +212,7 @@ impl<T: ?Sized> RwLock<T> {
|
|||
/// release the shared access when it is dropped.
|
||||
#[inline]
|
||||
pub fn try_read_for(&self, timeout: Duration) -> Option<RwLockReadGuard<T>> {
|
||||
if self.raw.try_lock_shared_for(timeout) {
|
||||
if self.raw.try_lock_shared_for(false, timeout) {
|
||||
Some(RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
|
@ -230,7 +230,93 @@ impl<T: ?Sized> RwLock<T> {
|
|||
/// release the shared access when it is dropped.
|
||||
#[inline]
|
||||
pub fn try_read_until(&self, timeout: Instant) -> Option<RwLockReadGuard<T>> {
|
||||
if self.raw.try_lock_shared_until(timeout) {
|
||||
if self.raw.try_lock_shared_until(false, timeout) {
|
||||
Some(RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Locks this rwlock with shared read access, blocking the current thread
|
||||
/// until it can be acquired.
|
||||
///
|
||||
/// The calling thread will be blocked until there are no more writers which
|
||||
/// hold the lock. There may be other readers currently inside the lock when
|
||||
/// this method returns.
|
||||
///
|
||||
/// Unlike `read`, this method is guaranteed to succeed without blocking if
|
||||
/// another read lock is held at the time of the call. This allows a thread
|
||||
/// to recursively lock a `RwLock`. However using this method can cause
|
||||
/// writers to starve since readers no longer block if a writer is waiting
|
||||
/// for the lock.
|
||||
///
|
||||
/// Returns an RAII guard which will release this thread's shared access
|
||||
/// once it is dropped.
|
||||
#[inline]
|
||||
pub fn read_recursive(&self) -> RwLockReadGuard<T> {
|
||||
self.raw.lock_shared(true);
|
||||
RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempts to acquire this rwlock with shared read access.
|
||||
///
|
||||
/// If the access could not be granted at this time, then `None` is returned.
|
||||
/// Otherwise, an RAII guard is returned which will release the shared access
|
||||
/// when it is dropped.
|
||||
///
|
||||
/// This method is guaranteed to succeed if another read lock is held at the
|
||||
/// time of the call. See the documentation for `read_recursive` for details.
|
||||
///
|
||||
/// This function does not block.
|
||||
#[inline]
|
||||
pub fn try_read_recursive(&self) -> Option<RwLockReadGuard<T>> {
|
||||
if self.raw.try_lock_shared(true) {
|
||||
Some(RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempts to acquire this rwlock with shared read access until a timeout
|
||||
/// is reached.
|
||||
///
|
||||
/// If the access could not be granted before the timeout expires, then
|
||||
/// `None` is returned. Otherwise, an RAII guard is returned which will
|
||||
/// release the shared access when it is dropped.
|
||||
///
|
||||
/// This method is guaranteed to succeed without blocking if another read
|
||||
/// lock is held at the time of the call. See the documentation for
|
||||
/// `read_recursive` for details.
|
||||
#[inline]
|
||||
pub fn try_read_recursive_for(&self, timeout: Duration) -> Option<RwLockReadGuard<T>> {
|
||||
if self.raw.try_lock_shared_for(true, timeout) {
|
||||
Some(RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempts to acquire this rwlock with shared read access until a timeout
|
||||
/// is reached.
|
||||
///
|
||||
/// If the access could not be granted before the timeout expires, then
|
||||
/// `None` is returned. Otherwise, an RAII guard is returned which will
|
||||
/// release the shared access when it is dropped.
|
||||
#[inline]
|
||||
pub fn try_read_recursive_until(&self, timeout: Instant) -> Option<RwLockReadGuard<T>> {
|
||||
if self.raw.try_lock_shared_until(true, timeout) {
|
||||
Some(RwLockReadGuard {
|
||||
rwlock: self,
|
||||
marker: PhantomData,
|
||||
|
@ -405,23 +491,44 @@ impl RwLock<()> {
|
|||
/// rwlock.
|
||||
#[inline]
|
||||
pub fn raw_read(&self) {
|
||||
self.raw.lock_shared();
|
||||
self.raw.lock_shared(false);
|
||||
}
|
||||
|
||||
/// Attempts to acquire this rwlock with shared read access.
|
||||
///
|
||||
/// This is similar to `read`, except that a `RwLockReadGuard` is not
|
||||
/// This is similar to `try_read`, except that a `RwLockReadGuard` is not
|
||||
/// returned. Instead you will need to call `raw_unlock` to release the
|
||||
/// rwlock.
|
||||
#[inline]
|
||||
pub fn raw_try_read(&self) -> bool {
|
||||
self.raw.try_lock_shared()
|
||||
self.raw.try_lock_shared(false)
|
||||
}
|
||||
|
||||
/// Locks this rwlock with shared read access, blocking the current thread
|
||||
/// until it can be acquired.
|
||||
///
|
||||
/// This is similar to `read_recursive`, except that a `RwLockReadGuard` is
|
||||
/// not returned. Instead you will need to call `raw_unlock` to release the
|
||||
/// rwlock.
|
||||
#[inline]
|
||||
pub fn raw_read_recursive(&self) {
|
||||
self.raw.lock_shared(true);
|
||||
}
|
||||
|
||||
/// Attempts to acquire this rwlock with shared read access.
|
||||
///
|
||||
/// This is similar to `try_read_recursive`, except that a `RwLockReadGuard` is not
|
||||
/// returned. Instead you will need to call `raw_unlock` to release the
|
||||
/// rwlock.
|
||||
#[inline]
|
||||
pub fn raw_try_read_recursive(&self) -> bool {
|
||||
self.raw.try_lock_shared(true)
|
||||
}
|
||||
|
||||
/// Locks this rwlock with exclusive write access, blocking the current
|
||||
/// thread until it can be acquired.
|
||||
///
|
||||
/// This is similar to `read`, except that a `RwLockReadGuard` is not
|
||||
/// This is similar to `write`, except that a `RwLockReadGuard` is not
|
||||
/// returned. Instead you will need to call `raw_unlock` to release the
|
||||
/// rwlock.
|
||||
#[inline]
|
||||
|
@ -431,7 +538,7 @@ impl RwLock<()> {
|
|||
|
||||
/// Attempts to lock this rwlock with exclusive write access.
|
||||
///
|
||||
/// This is similar to `read`, except that a `RwLockReadGuard` is not
|
||||
/// This is similar to `try_write`, except that a `RwLockReadGuard` is not
|
||||
/// returned. Instead you will need to call `raw_unlock` to release the
|
||||
/// rwlock.
|
||||
#[inline]
|
||||
|
@ -472,6 +579,7 @@ impl<'a, T: ?Sized + 'a> RwLockReadGuard<'a, T> {
|
|||
#[inline]
|
||||
pub fn unlock_fair(self) {
|
||||
self.rwlock.raw.unlock_shared(true);
|
||||
mem::forget(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,6 +633,7 @@ impl<'a, T: ?Sized + 'a> RwLockWriteGuard<'a, T> {
|
|||
#[inline]
|
||||
pub fn unlock_fair(self) {
|
||||
self.rwlock.raw.unlock_exclusive(true);
|
||||
mem::forget(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,6 +670,7 @@ mod tests {
|
|||
use std::thread;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::time::Duration;
|
||||
use RwLock;
|
||||
|
||||
#[derive(Eq, PartialEq, Debug)]
|
||||
|
@ -788,14 +898,12 @@ mod tests {
|
|||
let mut handles = Vec::new();
|
||||
for _ in 0..8 {
|
||||
let x = x.clone();
|
||||
handles.push(thread::spawn(move || {
|
||||
for _ in 0..100 {
|
||||
let mut writer = x.write();
|
||||
*writer += 1;
|
||||
let cur_val = *writer;
|
||||
let reader = writer.downgrade();
|
||||
assert_eq!(cur_val, *reader);
|
||||
}
|
||||
handles.push(thread::spawn(move || for _ in 0..100 {
|
||||
let mut writer = x.write();
|
||||
*writer += 1;
|
||||
let cur_val = *writer;
|
||||
let reader = writer.downgrade();
|
||||
assert_eq!(cur_val, *reader);
|
||||
}));
|
||||
}
|
||||
for handle in handles {
|
||||
|
@ -803,4 +911,16 @@ mod tests {
|
|||
}
|
||||
assert_eq!(*x.read(), 800);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rwlock_recursive() {
|
||||
let arc = Arc::new(RwLock::new(1));
|
||||
let arc2 = arc.clone();
|
||||
let _lock1 = arc.read();
|
||||
thread::spawn(move || { let _lock = arc2.write(); });
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
|
||||
// A normal read would block here since there is a pending writer
|
||||
let _lock2 = arc.read_recursive();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"409f95e74eb045b1e188b71514c785feb0b55e69afa3545b72678115b46448fb","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5e05b024f653a5ce199e77cbbbd42fb5553562ec714b819421ed0c3e552a75d7","README.md":"4a6ab55d5ce8d3ca804db6886b1d926dc12dbc874a526ec5febca61149e2c6c0","src/lib.rs":"868e71a2538bdec347a92bc7e3d16b0f5fa6a2be6a0ade4de37fd373a85626c5"},"package":"15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"}
|
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.0.0"
|
||||
authors = ["Robert Grosse <n210241048576@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/storyyeller/stable_deref_trait"
|
||||
documentation = "https://docs.rs/stable_deref_trait/1.0.0/stable_deref_trait"
|
||||
categories = ["no-std"]
|
||||
description = """
|
||||
An unsafe marker trait for types like Box and Rc that dereference to a stable address even when moved, and hence can be used with libraries such as owning_ref and rental.
|
||||
"""
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
|
||||
[dependencies]
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,25 @@
|
|||
Copyright (c) 2017 Robert Grosse
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,5 @@
|
|||
This crate defines an unsafe marker trait, StableDeref, for container types which deref to a fixed address which is valid even when the containing type is moved. For example, Box, Vec, Rc, Arc and String implement this trait. Additionally, it defines CloneStableDeref for types like Rc where clones deref to the same address.
|
||||
|
||||
It is intended to be used by crates such as [owning_ref](https://crates.io/crates/owning_ref) and [rental](https://crates.io/crates/rental), as well as library authors who wish to make their code interoperable with such crates. For example, if you write a custom Vec type, you can implement StableDeref, and then users will be able to use your custom Vec type together with owning_ref and rental.
|
||||
|
||||
no_std support can be enabled by disabling default features (specifically "std"). In this case, the trait will not be implemented for the std types mentioned above, but you can still use it for your own types.
|
|
@ -0,0 +1,172 @@
|
|||
// Copyright 2017 Robert Grosse
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*!
|
||||
This module defines an unsafe marker trait, StableDeref, for container types that deref to a fixed address which is valid even when the containing type is moved. For example, Box, Vec, Rc, Arc and String implement this trait. Additionally, it defines CloneStableDeref for types like Rc where clones deref to the same address.
|
||||
|
||||
It is intended to be used by crates such as [owning_ref](https://crates.io/crates/owning_ref) and [rental](https://crates.io/crates/rental), as well as library authors who wish to make their code interoperable with such crates. For example, if you write a custom Vec type, you can implement StableDeref, and then users will be able to use your custom type together with owning_ref and rental.
|
||||
|
||||
no_std support can be enabled by disabling default features (specifically "std"). In this case, the trait will not be implemented for the std types mentioned above, but you can still use it for your own types.
|
||||
*/
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
extern crate core;
|
||||
|
||||
use core::ops::Deref;
|
||||
|
||||
|
||||
/**
|
||||
An unsafe marker trait for types that deref to a stable address, even when moved. For example, this is implemented by Box, Vec, Rc, Arc and String, among others. Even when a Box is moved, the underlying storage remains at a fixed location.
|
||||
|
||||
More specifically, implementors must ensure that the result of calling deref() is valid for the lifetime of the object, not just the lifetime of the borrow, and that the deref is valid even if the object is moved. Also, it must be valid even after invoking arbitrary &self methods or doing anything transitively accessible from &Self. If Self also implements DerefMut, the same restrictions apply to deref_mut() and it must remain valid if anything transitively accessible from the result of deref_mut() is mutated/called. Additionally, multiple calls to deref, (and deref_mut if implemented) must return the same address. No requirements are placed on &mut self methods other than deref_mut() and drop(), if applicable.
|
||||
|
||||
Basically, it must be valid to convert the result of deref() to a pointer, and later dereference that pointer, as long as the original object is still live, even if it has been moved or &self methods have been called on it. If DerefMut is also implemented, it must be valid to get pointers from deref() and deref_mut() and dereference them while the object is live, as long as you don't simultaneously dereference both of them.
|
||||
|
||||
Additionally, Deref and DerefMut implementations must not panic, but users of the trait are not allowed to rely on this fact (so that this restriction can be removed later without breaking backwards compatibility, should the need arise).
|
||||
|
||||
Here are some examples to help illustrate the requirements for implementing this trait:
|
||||
|
||||
```
|
||||
# use std::ops::Deref;
|
||||
struct Foo(u8);
|
||||
impl Deref for Foo {
|
||||
type Target = u8;
|
||||
fn deref(&self) -> &Self::Target { &self.0 }
|
||||
}
|
||||
```
|
||||
|
||||
Foo cannot implement StableDeref because the int will move when Foo is moved, invalidating the result of deref().
|
||||
|
||||
```
|
||||
# use std::ops::Deref;
|
||||
struct Foo(Box<u8>);
|
||||
impl Deref for Foo {
|
||||
type Target = u8;
|
||||
fn deref(&self) -> &Self::Target { &*self.0 }
|
||||
}
|
||||
```
|
||||
|
||||
Foo can safely implement StableDeref, due to the use of Box.
|
||||
|
||||
|
||||
```
|
||||
# use std::ops::Deref;
|
||||
# use std::ops::DerefMut;
|
||||
# use std::rc::Rc;
|
||||
#[derive(Clone)]
|
||||
struct Foo(Rc<u8>);
|
||||
impl Deref for Foo {
|
||||
type Target = u8;
|
||||
fn deref(&self) -> &Self::Target { &*self.0 }
|
||||
}
|
||||
impl DerefMut for Foo {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target { Rc::make_mut(&mut self.0) }
|
||||
}
|
||||
```
|
||||
|
||||
This is a simple implementation of copy-on-write: Foo's deref_mut will copy the underlying int if it is not uniquely owned, ensuring unique access at the point where deref_mut() returns. However, Foo cannot implement StableDeref because calling deref_mut(), followed by clone().deref() will result in mutable and immutable references to the same location. Note that if the DerefMut implementation were removed, Foo could safely implement StableDeref. Likewise, if the Clone implementation were removed, it would be safe to implement StableDeref, although Foo would not be very useful in that case, (without clones, the rc will always be uniquely owned).
|
||||
|
||||
|
||||
```
|
||||
# use std::ops::Deref;
|
||||
struct Foo;
|
||||
impl Deref for Foo {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &Self::Target { &"Hello" }
|
||||
}
|
||||
```
|
||||
Foo can safely implement StableDeref. It doesn't own the data being derefed, but the data is gaurenteed to live long enough, due to it being 'static.
|
||||
|
||||
```
|
||||
# use std::ops::Deref;
|
||||
# use std::cell::Cell;
|
||||
struct Foo(Cell<bool>);
|
||||
impl Deref for Foo {
|
||||
type Target = str;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
let b = self.0.get();
|
||||
self.0.set(!b);
|
||||
if b { &"Hello" } else { &"World" }
|
||||
}
|
||||
}
|
||||
```
|
||||
Foo cannot safely implement StableDeref, even though every possible result of deref lives long enough. In order to safely implement StableAddress, multiple calls to deref must return the same result.
|
||||
|
||||
```
|
||||
# use std::ops::Deref;
|
||||
# use std::ops::DerefMut;
|
||||
struct Foo(Box<(u8, u8)>);
|
||||
impl Deref for Foo {
|
||||
type Target = u8;
|
||||
fn deref(&self) -> &Self::Target { &self.0.deref().0 }
|
||||
}
|
||||
impl DerefMut for Foo {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0.deref_mut().1 }
|
||||
}
|
||||
```
|
||||
|
||||
Foo cannot implement StableDeref because deref and deref_mut return different addresses.
|
||||
|
||||
|
||||
*/
|
||||
pub unsafe trait StableDeref: Deref {}
|
||||
|
||||
/**
|
||||
An unsafe marker trait for types where clones deref to the same address. This has all the requirements of StableDeref, and additionally requires that after calling clone(), both the old and new value deref to the same address. For example, Rc and Arc implement CloneStableDeref, but Box and Vec do not.
|
||||
|
||||
Note that a single type should never implement both DerefMut and CloneStableDeref. If it did, this would let you get two mutable references to the same location, by cloning and then calling deref_mut() on both values.
|
||||
*/
|
||||
pub unsafe trait CloneStableDeref: StableDeref + Clone {}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// std types integration
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::boxed::Box;
|
||||
#[cfg(feature = "std")]
|
||||
use std::rc::Rc;
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync::{MutexGuard, RwLockReadGuard, RwLockWriteGuard};
|
||||
#[cfg(feature = "std")]
|
||||
use std::cell::{Ref, RefMut};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<T: ?Sized> StableDeref for Box<T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<T> StableDeref for Vec<T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl StableDeref for String {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<T: ?Sized> StableDeref for Rc<T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<T: ?Sized> CloneStableDeref for Rc<T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<T: ?Sized> StableDeref for Arc<T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<T: ?Sized> CloneStableDeref for Arc<T> {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for Ref<'a, T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for RefMut<'a, T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for MutexGuard<'a, T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for RwLockReadGuard<'a, T> {}
|
||||
#[cfg(feature = "std")]
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for RwLockWriteGuard<'a, T> {}
|
||||
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for &'a T {}
|
||||
unsafe impl<'a, T: ?Sized> CloneStableDeref for &'a T {}
|
||||
unsafe impl<'a, T: ?Sized> StableDeref for &'a mut T {}
|
|
@ -381,7 +381,7 @@ dependencies = [
|
|||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nsstring_vendor 0.1.0",
|
||||
"parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"selectors 0.19.0",
|
||||
"style 0.0.1",
|
||||
"style_traits 0.0.1",
|
||||
|
@ -606,15 +606,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.2.4"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.3.8"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"owning_ref 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -882,6 +885,7 @@ name = "servo_arc"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -904,6 +908,11 @@ name = "smallvec"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.6.0"
|
||||
|
@ -935,7 +944,8 @@ dependencies = [
|
|||
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pdqsort 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"precomputed-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1307,8 +1317,8 @@ dependencies = [
|
|||
"checksum num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a225d1e2717567599c24f88e49f00856c6e825a12125181ee42c4257e3688d39"
|
||||
"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba"
|
||||
"checksum ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da12c96037889ae0be29dd2bdd260e5a62a7df24e6466d5a15bb8131c1c200a8"
|
||||
"checksum owning_ref 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d52571ddcb42e9c900c901a18d8d67e393df723fcd51dd59c5b1a85d0acb6cc"
|
||||
"checksum parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fa12d706797d42551663426a45e2db2e0364bd1dbf6aeada87e89c5f981f43e9"
|
||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||
"checksum parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "37f364e2ce5efa24c7d0b6646d5bb61145551a0112f107ffd7499f1a3e322fbd"
|
||||
"checksum parking_lot_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "56a19dcbb5d1e32b6cccb8a9aa1fc2a38418c8699652e735e2bf391a3dc0aa16"
|
||||
"checksum pdqsort 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ceca1642c89148ca05611cc775a0c383abef355fc4907c4e95f49f7b09d6287c"
|
||||
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
@ -1341,6 +1351,7 @@ dependencies = [
|
|||
"checksum siphasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ffc669b726f2bc9a3bcff66e5e23b56ba6bf70e22a34c3d7b6d0b3450b65b84"
|
||||
"checksum smallvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e"
|
||||
"checksum smallvec 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e40af10aafe98b4d8294ae8388d8a5cd0707c65d364872efe72d063ec44bee0"
|
||||
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
||||
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
|
||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
"checksum synom 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "27e31aa4b09b9f4cb12dff3c30ba503e17b1a624413d764d32dab76e3920e5bc"
|
||||
|
|
|
@ -379,7 +379,7 @@ dependencies = [
|
|||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nsstring_vendor 0.1.0",
|
||||
"parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"selectors 0.19.0",
|
||||
"style 0.0.1",
|
||||
"style_traits 0.0.1",
|
||||
|
@ -593,15 +593,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.2.4"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.3.8"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"owning_ref 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -869,6 +872,7 @@ name = "servo_arc"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -891,6 +895,11 @@ name = "smallvec"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.6.0"
|
||||
|
@ -922,7 +931,8 @@ dependencies = [
|
|||
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pdqsort 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"precomputed-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1294,8 +1304,8 @@ dependencies = [
|
|||
"checksum num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a225d1e2717567599c24f88e49f00856c6e825a12125181ee42c4257e3688d39"
|
||||
"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba"
|
||||
"checksum ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da12c96037889ae0be29dd2bdd260e5a62a7df24e6466d5a15bb8131c1c200a8"
|
||||
"checksum owning_ref 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d52571ddcb42e9c900c901a18d8d67e393df723fcd51dd59c5b1a85d0acb6cc"
|
||||
"checksum parking_lot 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fa12d706797d42551663426a45e2db2e0364bd1dbf6aeada87e89c5f981f43e9"
|
||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||
"checksum parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "37f364e2ce5efa24c7d0b6646d5bb61145551a0112f107ffd7499f1a3e322fbd"
|
||||
"checksum parking_lot_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "56a19dcbb5d1e32b6cccb8a9aa1fc2a38418c8699652e735e2bf391a3dc0aa16"
|
||||
"checksum pdqsort 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ceca1642c89148ca05611cc775a0c383abef355fc4907c4e95f49f7b09d6287c"
|
||||
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
@ -1328,6 +1338,7 @@ dependencies = [
|
|||
"checksum siphasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ffc669b726f2bc9a3bcff66e5e23b56ba6bf70e22a34c3d7b6d0b3450b65b84"
|
||||
"checksum smallvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e"
|
||||
"checksum smallvec 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e40af10aafe98b4d8294ae8388d8a5cd0707c65d364872efe72d063ec44bee0"
|
||||
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
||||
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
|
||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
"checksum synom 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "27e31aa4b09b9f4cb12dff3c30ba503e17b1a624413d764d32dab76e3920e5bc"
|
||||
|
|
Загрузка…
Ссылка в новой задаче