Skip to content

Commit b00aa4c

Browse files
committed
fix(upstream): MTLock is removed
1 parent 84db7fb commit b00aa4c

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ctxt.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::sync::Arc;
88

99
use rusqlite::{Connection, OptionalExtension};
1010
use rustc_data_structures::fx::FxHashMap;
11-
use rustc_data_structures::sync::{DynSend, DynSync, MTLock, RwLock};
11+
use rustc_data_structures::sync::{DynSend, DynSync, Lock, RwLock};
1212
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
1313
use rustc_middle::ty::TyCtxt;
1414
use rustc_serialize::{Decodable, Encodable};
@@ -53,8 +53,8 @@ pub(crate) trait PersistentQuery: QueryValueDecodable {
5353

5454
pub struct AnalysisCtxt<'tcx> {
5555
pub tcx: TyCtxt<'tcx>,
56-
pub local_conn: MTLock<Connection>,
57-
pub sql_conn: RwLock<FxHashMap<CrateNum, Option<Arc<MTLock<Connection>>>>>,
56+
pub local_conn: Lock<Connection>,
57+
pub sql_conn: RwLock<FxHashMap<CrateNum, Option<Arc<Lock<Connection>>>>>,
5858

5959
pub call_stack: RwLock<Vec<UseSite<'tcx>>>,
6060
pub query_cache: RwLock<AnyMap<dyn Any + DynSend + DynSync>>,
@@ -136,7 +136,7 @@ impl<'tcx> AnalysisCtxt<'tcx> {
136136
unsafe { std::mem::transmute(cache) }
137137
}
138138

139-
pub(crate) fn sql_connection(&self, cnum: CrateNum) -> Option<Arc<MTLock<Connection>>> {
139+
pub(crate) fn sql_connection(&self, cnum: CrateNum) -> Option<Arc<Lock<Connection>>> {
140140
if let Some(v) = self.sql_conn.borrow().get(&cnum) {
141141
return v.clone();
142142
}
@@ -179,7 +179,7 @@ impl<'tcx> AnalysisCtxt<'tcx> {
179179
);
180180
}
181181

182-
result = Some(Arc::new(MTLock::new(conn)));
182+
result = Some(Arc::new(Lock::new(conn)));
183183
break;
184184
}
185185

@@ -311,7 +311,7 @@ impl<'tcx> AnalysisCtxt<'tcx> {
311311

312312
let ret = Self {
313313
tcx,
314-
local_conn: MTLock::new(conn),
314+
local_conn: Lock::new(conn),
315315
sql_conn: Default::default(),
316316
call_stack: Default::default(),
317317
query_cache: Default::default(),

src/monomorphize_collector.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// * `Spanned<MonoItem>` is returned in `AccessMap` instead of just `MonoItem`.
1111

1212
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
13-
use rustc_data_structures::sync::{MTLock, par_for_each_in};
13+
use rustc_data_structures::sync::{Lock, par_for_each_in};
1414
use rustc_data_structures::unord::UnordSet;
1515
use rustc_hir as hir;
1616
use rustc_hir::attrs::InlineAttr;
@@ -91,12 +91,12 @@ fn custom_coerce_unsize_info<'tcx>(
9191
/// The state that is shared across the concurrent threads that are doing collection.
9292
struct SharedState<'tcx> {
9393
/// Items that have been or are currently being recursively collected.
94-
visited: MTLock<UnordSet<MonoItem<'tcx>>>,
94+
visited: Lock<UnordSet<MonoItem<'tcx>>>,
9595
/// Items that have been or are currently being recursively treated as "mentioned", i.e., their
9696
/// consts are evaluated but nothing is added to the collection.
97-
mentioned: MTLock<UnordSet<MonoItem<'tcx>>>,
97+
mentioned: Lock<UnordSet<MonoItem<'tcx>>>,
9898
/// Which items are being used where, for better errors.
99-
usage_map: MTLock<UsageMap<'tcx>>,
99+
usage_map: Lock<UsageMap<'tcx>>,
100100
}
101101

102102
#[derive(PartialEq)]
@@ -197,7 +197,7 @@ fn collect_items_root<'tcx>(
197197
state: &SharedState<'tcx>,
198198
recursion_limit: Limit,
199199
) {
200-
if !state.visited.lock_mut().insert(starting_item.node) {
200+
if !state.visited.lock().insert(starting_item.node) {
201201
// We've been here already, no need to search again.
202202
return;
203203
}
@@ -398,7 +398,7 @@ fn collect_items_rec<'tcx>(
398398
if mode == CollectionMode::UsedItems {
399399
state
400400
.usage_map
401-
.lock_mut()
401+
.lock()
402402
.record_used(starting_item.node, &used_items);
403403
}
404404

@@ -407,7 +407,7 @@ fn collect_items_rec<'tcx>(
407407
if mode == CollectionMode::UsedItems {
408408
used_items.items.retain(|k, _| {
409409
visited
410-
.get_mut_or_init(|| state.visited.lock_mut())
410+
.get_mut_or_init(|| state.visited.lock())
411411
.insert(*k)
412412
});
413413
}
@@ -416,7 +416,7 @@ fn collect_items_rec<'tcx>(
416416
mentioned_items.items.retain(|k, _| {
417417
!visited.get_or_init(|| state.visited.lock()).contains(k)
418418
&& mentioned
419-
.get_mut_or_init(|| state.mentioned.lock_mut())
419+
.get_mut_or_init(|| state.mentioned.lock())
420420
.insert(*k)
421421
});
422422
}
@@ -1605,9 +1605,9 @@ pub fn collect_crate_mono_items(
16051605
debug!("building mono item graph, beginning at roots");
16061606

16071607
let state = SharedState {
1608-
visited: MTLock::new(UnordSet::default()),
1609-
mentioned: MTLock::new(UnordSet::default()),
1610-
usage_map: MTLock::new(UsageMap::new()),
1608+
visited: Lock::new(UnordSet::default()),
1609+
mentioned: Lock::new(UnordSet::default()),
1610+
usage_map: Lock::new(UsageMap::new()),
16111611
};
16121612
let recursion_limit = tcx.recursion_limit();
16131613

0 commit comments

Comments
 (0)