File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ libgit2-sys = "0.7"
4141log = " 0.4"
4242num_cpus = " 1.0"
4343same-file = " 1"
44- scoped-tls = " 0.1"
4544semver = { version = " 0.9.0" , features = [" serde" ] }
4645serde = " 1.0"
4746serde_derive = " 1.0"
Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ extern crate libgit2_sys;
3131extern crate log;
3232extern crate num_cpus;
3333extern crate same_file;
34- #[ macro_use]
35- extern crate scoped_tls;
3634extern crate semver;
3735extern crate serde;
3836#[ macro_use]
Original file line number Diff line number Diff line change @@ -148,8 +148,11 @@ impl<'cfg> RegistryIndex<'cfg> {
148148 features,
149149 yanked,
150150 links,
151- } = super :: DEFAULT_ID . set ( & self . source_id , || {
152- serde_json:: from_str :: < RegistryPackage > ( line)
151+ } = super :: DEFAULT_ID . with ( |slot| {
152+ * slot. borrow_mut ( ) = Some ( self . source_id . clone ( ) ) ;
153+ let res = serde_json:: from_str :: < RegistryPackage > ( line) ;
154+ drop ( slot. borrow_mut ( ) . take ( ) ) ;
155+ res
153156 } ) ?;
154157 let pkgid = PackageId :: new ( & name, & vers, & self . source_id ) ?;
155158 let summary = Summary :: new ( pkgid, deps. inner , features, links) ?;
Original file line number Diff line number Diff line change 159159//! ```
160160
161161use std:: borrow:: Cow ;
162+ use std:: cell:: RefCell ;
162163use std:: collections:: BTreeMap ;
163164use std:: fmt;
164165use std:: fs:: File ;
@@ -454,7 +455,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
454455//
455456// If you're reading this and find this thread local funny, check to see if that
456457// PR is merged. If it is then let's ditch this thread local!
457- scoped_thread_local ! ( static DEFAULT_ID : SourceId ) ;
458+ thread_local ! ( static DEFAULT_ID : RefCell < Option < SourceId >> = Default :: default ( ) ) ;
458459
459460impl < ' de > de:: Deserialize < ' de > for DependencyList {
460461 fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
@@ -506,7 +507,7 @@ fn parse_registry_dependency(dep: RegistryDependency) -> CargoResult<Dependency>
506507 let id = if let Some ( registry) = registry {
507508 SourceId :: for_registry ( & registry. to_url ( ) ?) ?
508509 } else {
509- DEFAULT_ID . with ( |id| id. clone ( ) )
510+ DEFAULT_ID . with ( |id| id. borrow ( ) . as_ref ( ) . unwrap ( ) . clone ( ) )
510511 } ;
511512
512513 let mut dep = Dependency :: parse_no_deprecated ( & name, Some ( & req) , & id) ?;
You can’t perform that action at this time.
0 commit comments