1
Fork 0

Rollup merge of #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 https://github.com/rust-lang/rust/pull/83185.

r? `@Zoxc` cc `@oli-obk`
This commit is contained in:
Yuki Okushi 2021-06-05 06:13:29 +09:00 committed by GitHub
commit 756431211d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,49 +43,9 @@ cfg_if! {
use std::ops::Add;
use std::panic::{resume_unwind, catch_unwind, AssertUnwindSafe};
/// This is a single threaded variant of AtomicCell provided by crossbeam.
/// Unlike `Atomic` this is intended for all `Copy` types,
/// but it lacks the explicit ordering arguments.
#[derive(Debug)]
pub struct AtomicCell<T: Copy>(Cell<T>);
impl<T: Copy> AtomicCell<T> {
#[inline]
pub fn new(v: T) -> Self {
AtomicCell(Cell::new(v))
}
#[inline]
pub fn get_mut(&mut self) -> &mut T {
self.0.get_mut()
}
}
impl<T: Copy> AtomicCell<T> {
#[inline]
pub fn into_inner(self) -> T {
self.0.into_inner()
}
#[inline]
pub fn load(&self) -> T {
self.0.get()
}
#[inline]
pub fn store(&self, val: T) {
self.0.set(val)
}
#[inline]
pub fn swap(&self, val: T) -> T {
self.0.replace(val)
}
}
/// This is a single threaded variant of `AtomicU64`, `AtomicUsize`, etc.
/// It differs from `AtomicCell` in that it has explicit ordering arguments
/// and is only intended for use with the native atomic types.
/// It has explicit ordering arguments and is only intended for use with
/// the native atomic types.
/// You should use this type through the `AtomicU64`, `AtomicUsize`, etc, type aliases
/// as it's not intended to be used separately.
#[derive(Debug)]
@ -159,22 +119,6 @@ cfg_if! {
(oper_a(), oper_b())
}
pub struct SerialScope;
impl SerialScope {
pub fn spawn<F>(&self, f: F)
where F: FnOnce(&SerialScope)
{
f(self)
}
}
pub fn scope<F, R>(f: F) -> R
where F: FnOnce(&SerialScope) -> R
{
f(&SerialScope)
}
#[macro_export]
macro_rules! parallel {
($($blocks:tt),*) => {
@ -318,8 +262,6 @@ cfg_if! {
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
pub use crossbeam_utils::atomic::AtomicCell;
pub use std::sync::Arc as Lrc;
pub use std::sync::Weak as Weak;