diff options
Diffstat (limited to 'vendor/scoped-tls')
-rw-r--r-- | vendor/scoped-tls/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/scoped-tls/Cargo.toml | 18 | ||||
-rw-r--r-- | vendor/scoped-tls/README.md | 2 | ||||
-rw-r--r-- | vendor/scoped-tls/appveyor.yml | 17 | ||||
-rw-r--r-- | vendor/scoped-tls/src/lib.rs | 22 |
5 files changed, 24 insertions, 37 deletions
diff --git a/vendor/scoped-tls/.cargo-checksum.json b/vendor/scoped-tls/.cargo-checksum.json index a82babc4a..ab1c98519 100644 --- a/vendor/scoped-tls/.cargo-checksum.json +++ b/vendor/scoped-tls/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"9b7a3fdb45ac3847229254d53222ed393d5e5426e7d126dc3a1adfeb35b8b438","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"5b42f802520064732b4097d9224cddffb6ad397536347bc996c95f433d893e85","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","src/lib.rs":"03cafc877737e72e8bc6fed874c5b1154ec7a0579c5f875f1da66df54b642864"},"package":"ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"}
\ No newline at end of file +{"files":{"Cargo.toml":"34fd266d7e61276cf49fb2a9ea9887331ef4e72595fed99b7d8735c86cd13631","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"0cf015ca6dd078c0f0e607508a4190c0a1328990069e6303c4709530960aab08","src/lib.rs":"ca804e29dde7dc843ab24f7f70c694eb43fac7c62194d85a58c8062caa0a84f4"},"package":"e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"}
\ No newline at end of file diff --git a/vendor/scoped-tls/Cargo.toml b/vendor/scoped-tls/Cargo.toml index 70c386117..08ec7b613 100644 --- a/vendor/scoped-tls/Cargo.toml +++ b/vendor/scoped-tls/Cargo.toml @@ -3,18 +3,22 @@ # 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 +# 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) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] +rust-version = "1.59" name = "scoped-tls" -version = "1.0.0" +version = "1.0.1" authors = ["Alex Crichton <alex@alexcrichton.com>"] -description = "Library implementation of the standard library's old `scoped_thread_local!`\nmacro for providing scoped access to thread local storage (TLS) so any type can\nbe stored into TLS.\n" +description = """ +Library implementation of the standard library's old `scoped_thread_local!` +macro for providing scoped access to thread local storage (TLS) so any type can +be stored into TLS. +""" homepage = "https://github.com/alexcrichton/scoped-tls" documentation = "https://docs.rs/scoped-tls" readme = "README.md" diff --git a/vendor/scoped-tls/README.md b/vendor/scoped-tls/README.md index 88bd62401..36e6480e2 100644 --- a/vendor/scoped-tls/README.md +++ b/vendor/scoped-tls/README.md @@ -11,7 +11,7 @@ as a library implementation on crates.io. ```toml # Cargo.toml [dependencies] -scoped-tls = "0.1" +scoped-tls = "1.0" ``` # License diff --git a/vendor/scoped-tls/appveyor.yml b/vendor/scoped-tls/appveyor.yml deleted file mode 100644 index 6a1b8dc19..000000000 --- a/vendor/scoped-tls/appveyor.yml +++ /dev/null @@ -1,17 +0,0 @@ -environment: - matrix: - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc - - TARGET: i686-pc-windows-gnu -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" - - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" - - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin - - SET PATH=%PATH%;C:\MinGW\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --verbose diff --git a/vendor/scoped-tls/src/lib.rs b/vendor/scoped-tls/src/lib.rs index 6fbcf11e3..d4567c2bc 100644 --- a/vendor/scoped-tls/src/lib.rs +++ b/vendor/scoped-tls/src/lib.rs @@ -56,8 +56,8 @@ macro_rules! scoped_thread_local { $(#[$attrs])* $vis static $name: $crate::ScopedKey<$ty> = $crate::ScopedKey { inner: { - thread_local!(static FOO: ::std::cell::Cell<usize> = { - ::std::cell::Cell::new(0) + ::std::thread_local!(static FOO: ::std::cell::Cell<*const ()> = const { + ::std::cell::Cell::new(::std::ptr::null()) }); &FOO }, @@ -75,7 +75,7 @@ macro_rules! scoped_thread_local { /// their contents. pub struct ScopedKey<T> { #[doc(hidden)] - pub inner: &'static LocalKey<Cell<usize>>, + pub inner: &'static LocalKey<Cell<*const ()>>, #[doc(hidden)] pub _marker: marker::PhantomData<T>, } @@ -86,8 +86,8 @@ impl<T> ScopedKey<T> { /// Inserts a value into this scoped thread local storage slot for a /// duration of a closure. /// - /// While `cb` is running, the value `t` will be returned by `get` unless - /// this function is called recursively inside of `cb`. + /// While `f` is running, the value `t` will be returned by `get` unless + /// this function is called recursively inside of `f`. /// /// Upon return, this function will restore the previous value, if any /// was available. @@ -120,8 +120,8 @@ impl<T> ScopedKey<T> { where F: FnOnce() -> R { struct Reset { - key: &'static LocalKey<Cell<usize>>, - val: usize, + key: &'static LocalKey<Cell<*const ()>>, + val: *const (), } impl Drop for Reset { fn drop(&mut self) { @@ -130,7 +130,7 @@ impl<T> ScopedKey<T> { } let prev = self.inner.with(|c| { let prev = c.get(); - c.set(t as *const T as usize); + c.set(t as *const T as *const ()); prev }); let _reset = Reset { key: self.inner, val: prev }; @@ -165,8 +165,8 @@ impl<T> ScopedKey<T> { where F: FnOnce(&T) -> R { let val = self.inner.with(|c| c.get()); - assert!(val != 0, "cannot access a scoped thread local \ - variable without calling `set` first"); + assert!(!val.is_null(), "cannot access a scoped thread local \ + variable without calling `set` first"); unsafe { f(&*(val as *const T)) } @@ -174,7 +174,7 @@ impl<T> ScopedKey<T> { /// Test whether this TLS key has been `set` for the current thread. pub fn is_set(&'static self) -> bool { - self.inner.with(|c| c.get() != 0) + self.inner.with(|c| !c.get().is_null()) } } |