Remove scoped_tls dependency

This is causing [conflicts] with rebuilding upstream in rust-lang/rust, so
remove this for now until we figure out a better solution.

[conflicts]: https://github.com/rust-lang/rust/pull/49053#issuecomment-375906970
This commit is contained in:
Alex Crichton 2018-03-24 09:51:33 -07:00
parent bcd0300f0e
commit 7cab2b20b3
4 changed files with 8 additions and 7 deletions

View file

@ -41,7 +41,6 @@ libgit2-sys = "0.7"
log = "0.4"
num_cpus = "1.0"
same-file = "1"
scoped-tls = "0.1"
semver = { version = "0.9.0", features = ["serde"] }
serde = "1.0"
serde_derive = "1.0"

View file

@ -31,8 +31,6 @@ extern crate libgit2_sys;
extern crate log;
extern crate num_cpus;
extern crate same_file;
#[macro_use]
extern crate scoped_tls;
extern crate semver;
extern crate serde;
#[macro_use]

View file

@ -148,8 +148,11 @@ impl<'cfg> RegistryIndex<'cfg> {
features,
yanked,
links,
} = super::DEFAULT_ID.set(&self.source_id, || {
serde_json::from_str::<RegistryPackage>(line)
} = super::DEFAULT_ID.with(|slot| {
*slot.borrow_mut() = Some(self.source_id.clone());
let res = serde_json::from_str::<RegistryPackage>(line);
drop(slot.borrow_mut().take());
res
})?;
let pkgid = PackageId::new(&name, &vers, &self.source_id)?;
let summary = Summary::new(pkgid, deps.inner, features, links)?;

View file

@ -159,6 +159,7 @@
//! ```
use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::fmt;
use std::fs::File;
@ -454,7 +455,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
//
// If you're reading this and find this thread local funny, check to see if that
// PR is merged. If it is then let's ditch this thread local!
scoped_thread_local!(static DEFAULT_ID: SourceId);
thread_local!(static DEFAULT_ID: RefCell<Option<SourceId>> = Default::default());
impl<'de> de::Deserialize<'de> for DependencyList {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
@ -506,7 +507,7 @@ fn parse_registry_dependency(dep: RegistryDependency) -> CargoResult<Dependency>
let id = if let Some(registry) = registry {
SourceId::for_registry(&registry.to_url()?)?
} else {
DEFAULT_ID.with(|id| id.clone())
DEFAULT_ID.with(|id| id.borrow().as_ref().unwrap().clone())
};
let mut dep = Dependency::parse_no_deprecated(&name, Some(&req), &id)?;