mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1806766 - Update scoped-tls to 1.0.1. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D165532
This commit is contained in:
parent
51d50a4340
commit
5077160c21
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -4682,9 +4682,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
|
@ -1569,6 +1569,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "1.0.10 -> 1.0.11"
|
||||
|
||||
[[audits.scoped-tls]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-run"
|
||||
delta = "1.0.0 -> 1.0.1"
|
||||
|
||||
[[audits.scroll]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"9b7a3fdb45ac3847229254d53222ed393d5e5426e7d126dc3a1adfeb35b8b438","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"5b42f802520064732b4097d9224cddffb6ad397536347bc996c95f433d893e85","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","src/lib.rs":"03cafc877737e72e8bc6fed874c5b1154ec7a0579c5f875f1da66df54b642864"},"package":"ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"}
|
||||
{"files":{"Cargo.toml":"34fd266d7e61276cf49fb2a9ea9887331ef4e72595fed99b7d8735c86cd13631","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"0cf015ca6dd078c0f0e607508a4190c0a1328990069e6303c4709530960aab08","src/lib.rs":"ca804e29dde7dc843ab24f7f70c694eb43fac7c62194d85a58c8062caa0a84f4"},"package":"e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"}
|
18
third_party/rust/scoped-tls/Cargo.toml
vendored
18
third_party/rust/scoped-tls/Cargo.toml
vendored
@ -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"
|
||||
|
2
third_party/rust/scoped-tls/README.md
vendored
2
third_party/rust/scoped-tls/README.md
vendored
@ -11,7 +11,7 @@ as a library implementation on crates.io.
|
||||
```toml
|
||||
# Cargo.toml
|
||||
[dependencies]
|
||||
scoped-tls = "0.1"
|
||||
scoped-tls = "1.0"
|
||||
```
|
||||
|
||||
# License
|
||||
|
17
third_party/rust/scoped-tls/appveyor.yml
vendored
17
third_party/rust/scoped-tls/appveyor.yml
vendored
@ -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
|
22
third_party/rust/scoped-tls/src/lib.rs
vendored
22
third_party/rust/scoped-tls/src/lib.rs
vendored
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user