File tree 4 files changed +8
-7
lines changed
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"
41
41
log = " 0.4"
42
42
num_cpus = " 1.0"
43
43
same-file = " 1"
44
- scoped-tls = " 0.1"
45
44
semver = { version = " 0.9.0" , features = [" serde" ] }
46
45
serde = " 1.0"
47
46
serde_derive = " 1.0"
Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ extern crate libgit2_sys;
31
31
extern crate log;
32
32
extern crate num_cpus;
33
33
extern crate same_file;
34
- #[ macro_use]
35
- extern crate scoped_tls;
36
34
extern crate semver;
37
35
extern crate serde;
38
36
#[ macro_use]
Original file line number Diff line number Diff line change @@ -148,8 +148,11 @@ impl<'cfg> RegistryIndex<'cfg> {
148
148
features,
149
149
yanked,
150
150
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
153
156
} ) ?;
154
157
let pkgid = PackageId :: new ( & name, & vers, & self . source_id ) ?;
155
158
let summary = Summary :: new ( pkgid, deps. inner , features, links) ?;
Original file line number Diff line number Diff line change 159
159
//! ```
160
160
161
161
use std:: borrow:: Cow ;
162
+ use std:: cell:: RefCell ;
162
163
use std:: collections:: BTreeMap ;
163
164
use std:: fmt;
164
165
use std:: fs:: File ;
@@ -454,7 +455,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
454
455
//
455
456
// If you're reading this and find this thread local funny, check to see if that
456
457
// 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 ( ) ) ;
458
459
459
460
impl < ' de > de:: Deserialize < ' de > for DependencyList {
460
461
fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error >
@@ -506,7 +507,7 @@ fn parse_registry_dependency(dep: RegistryDependency) -> CargoResult<Dependency>
506
507
let id = if let Some ( registry) = registry {
507
508
SourceId :: for_registry ( & registry. to_url ( ) ?) ?
508
509
} else {
509
- DEFAULT_ID . with ( |id| id. clone ( ) )
510
+ DEFAULT_ID . with ( |id| id. borrow ( ) . as_ref ( ) . unwrap ( ) . clone ( ) )
510
511
} ;
511
512
512
513
let mut dep = Dependency :: parse_no_deprecated ( & name, Some ( & req) , & id) ?;
You can’t perform that action at this time.
0 commit comments