Skip to content

Commit 7564312

Browse files
authored
Rollup merge of rust-lang#83653 - jyn514:unused-sync-code, r=wesleywiser
Remove unused code from `rustc_data_structures::sync` Found using https://github.com/est31/warnalyzer. Follow-up to rust-lang#83185. r? `@Zoxc` cc `@oli-obk`
2 parents efc4e37 + 3412957 commit 7564312

File tree

1 file changed

+2
-60
lines changed
  • compiler/rustc_data_structures/src

1 file changed

+2
-60
lines changed

compiler/rustc_data_structures/src/sync.rs

+2-60
Original file line numberDiff line numberDiff line change
@@ -43,49 +43,9 @@ 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.
87-
/// It differs from `AtomicCell` in that it has explicit ordering arguments
88-
/// and is only intended for use with the native atomic types.
47+
/// It has explicit ordering arguments and is only intended for use with
48+
/// the native atomic types.
8949
/// You should use this type through the `AtomicU64`, `AtomicUsize`, etc, type aliases
9050
/// as it's not intended to be used separately.
9151
#[derive(Debug)]
@@ -159,22 +119,6 @@ cfg_if! {
159119
(oper_a(), oper_b())
160120
}
161121

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-
178122
#[macro_export]
179123
macro_rules! parallel {
180124
($($blocks:tt),*) => {
@@ -318,8 +262,6 @@ cfg_if! {
318262

319263
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
320264

321-
pub use crossbeam_utils::atomic::AtomicCell;
322-
323265
pub use std::sync::Arc as Lrc;
324266
pub use std::sync::Weak as Weak;
325267

0 commit comments

Comments
 (0)