Skip to content

Commit 1a5cc25

Browse files
committed
Remove unused code from rustc_data_structures::sync
Found using https://github.com/est31/warnalyzer.
1 parent c4c2ab5 commit 1a5cc25

File tree

1 file changed

+0
-110
lines changed
  • compiler/rustc_data_structures/src

1 file changed

+0
-110
lines changed

compiler/rustc_data_structures/src/sync.rs

-110
Original file line numberDiff line numberDiff line change
@@ -43,46 +43,6 @@ cfg_if! {
4343
use std::ops::Add;
4444
use std::panic::{resume_unwind, catch_unwind, AssertUnwindSafe};
4545

46-
/// This is a single threaded variant of AtomicCell provided by crossbeam.
47-
/// Unlike `Atomic` this is intended for all `Copy` types,
48-
/// but it lacks the explicit ordering arguments.
49-
#[derive(Debug)]
50-
pub struct AtomicCell<T: Copy>(Cell<T>);
51-
52-
impl<T: Copy> AtomicCell<T> {
53-
#[inline]
54-
pub fn new(v: T) -> Self {
55-
AtomicCell(Cell::new(v))
56-
}
57-
58-
#[inline]
59-
pub fn get_mut(&mut self) -> &mut T {
60-
self.0.get_mut()
61-
}
62-
}
63-
64-
impl<T: Copy> AtomicCell<T> {
65-
#[inline]
66-
pub fn into_inner(self) -> T {
67-
self.0.into_inner()
68-
}
69-
70-
#[inline]
71-
pub fn load(&self) -> T {
72-
self.0.get()
73-
}
74-
75-
#[inline]
76-
pub fn store(&self, val: T) {
77-
self.0.set(val)
78-
}
79-
80-
#[inline]
81-
pub fn swap(&self, val: T) -> T {
82-
self.0.replace(val)
83-
}
84-
}
85-
8646
/// This is a single threaded variant of `AtomicU64`, `AtomicUsize`, etc.
8747
/// It differs from `AtomicCell` in that it has explicit ordering arguments
8848
/// and is only intended for use with the native atomic types.
@@ -99,11 +59,6 @@ cfg_if! {
9959
}
10060

10161
impl<T: Copy> Atomic<T> {
102-
#[inline]
103-
pub fn into_inner(self) -> T {
104-
self.0.into_inner()
105-
}
106-
10762
#[inline]
10863
pub fn load(&self, _: Ordering) -> T {
10964
self.0.get()
@@ -113,11 +68,6 @@ cfg_if! {
11368
pub fn store(&self, val: T, _: Ordering) {
11469
self.0.set(val)
11570
}
116-
117-
#[inline]
118-
pub fn swap(&self, val: T, _: Ordering) -> T {
119-
self.0.replace(val)
120-
}
12171
}
12272

12373
impl<T: Copy + PartialEq> Atomic<T> {
@@ -159,22 +109,6 @@ cfg_if! {
159109
(oper_a(), oper_b())
160110
}
161111

162-
pub struct SerialScope;
163-
164-
impl SerialScope {
165-
pub fn spawn<F>(&self, f: F)
166-
where F: FnOnce(&SerialScope)
167-
{
168-
f(self)
169-
}
170-
}
171-
172-
pub fn scope<F, R>(f: F) -> R
173-
where F: FnOnce(&SerialScope) -> R
174-
{
175-
f(&SerialScope)
176-
}
177-
178112
#[macro_export]
179113
macro_rules! parallel {
180114
($($blocks:tt),*) => {
@@ -246,12 +180,6 @@ cfg_if! {
246180
pub fn new<F: FnMut(usize) -> T>(mut f: F) -> WorkerLocal<T> {
247181
WorkerLocal(OneThread::new(f(0)))
248182
}
249-
250-
/// Returns the worker-local value for each thread
251-
#[inline]
252-
pub fn into_inner(self) -> Vec<T> {
253-
vec![OneThread::into_inner(self.0)]
254-
}
255183
}
256184

257185
impl<T> Deref for WorkerLocal<T> {
@@ -279,16 +207,6 @@ cfg_if! {
279207
self.0
280208
}
281209

282-
#[inline(always)]
283-
pub fn get_mut(&mut self) -> &mut T {
284-
&mut self.0
285-
}
286-
287-
#[inline(always)]
288-
pub fn lock(&self) -> &T {
289-
&self.0
290-
}
291-
292210
#[inline(always)]
293211
pub fn lock_mut(&mut self) -> &mut T {
294212
&mut self.0
@@ -318,8 +236,6 @@ cfg_if! {
318236

319237
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
320238

321-
pub use crossbeam_utils::atomic::AtomicCell;
322-
323239
pub use std::sync::Arc as Lrc;
324240
pub use std::sync::Weak as Weak;
325241

@@ -521,16 +437,6 @@ impl<T> RwLock<T> {
521437
RwLock(InnerRwLock::new(inner))
522438
}
523439

524-
#[inline(always)]
525-
pub fn into_inner(self) -> T {
526-
self.0.into_inner()
527-
}
528-
529-
#[inline(always)]
530-
pub fn get_mut(&mut self) -> &mut T {
531-
self.0.get_mut()
532-
}
533-
534440
#[cfg(not(parallel_compiler))]
535441
#[inline(always)]
536442
pub fn read(&self) -> ReadGuard<'_, T> {
@@ -547,11 +453,6 @@ impl<T> RwLock<T> {
547453
}
548454
}
549455

550-
#[inline(always)]
551-
pub fn with_read_lock<F: FnOnce(&T) -> R, R>(&self, f: F) -> R {
552-
f(&*self.read())
553-
}
554-
555456
#[cfg(not(parallel_compiler))]
556457
#[inline(always)]
557458
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
@@ -580,11 +481,6 @@ impl<T> RwLock<T> {
580481
}
581482
}
582483

583-
#[inline(always)]
584-
pub fn with_write_lock<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> R {
585-
f(&mut *self.write())
586-
}
587-
588484
#[inline(always)]
589485
pub fn borrow(&self) -> ReadGuard<'_, T> {
590486
self.read()
@@ -633,12 +529,6 @@ impl<T> OneThread<T> {
633529
inner,
634530
}
635531
}
636-
637-
#[inline(always)]
638-
pub fn into_inner(value: Self) -> T {
639-
value.check();
640-
value.inner
641-
}
642532
}
643533

644534
impl<T> Deref for OneThread<T> {

0 commit comments

Comments
 (0)