Skip to content

Commit

Permalink
fix: set up MSRV in CI (#61)
Browse files Browse the repository at this point in the history
* Use deprecated `std::atomic::spin_loop_hint()` to support older Rust

* Match tracing MSRV in CI

Fixes #60.
  • Loading branch information
djc authored Aug 2, 2021
1 parent 7aa23c6 commit dfcc908
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
rust:
- stable
- nightly
- 1.42.0
steps:
- uses: actions/checkout@master
- name: Install toolchain
Expand Down Expand Up @@ -97,4 +98,3 @@ jobs:
with:
command: fmt
args: -- --check

13 changes: 12 additions & 1 deletion src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ mod inner {
cell::UnsafeCell, hint, lazy_static, sync::Mutex, thread::yield_now, thread_local,
};

pub(crate) mod hint {
pub(crate) use super::hint::spin_loop_hint as spin_loop;
}

pub(crate) mod alloc {
#![allow(dead_code)]
use loom::alloc;
Expand Down Expand Up @@ -65,12 +69,19 @@ mod inner {
#![allow(dead_code)]
pub(crate) use lazy_static::lazy_static;
pub(crate) use std::{
hint,
sync::{atomic, Mutex},
thread::yield_now,
thread_local,
};

pub(crate) mod hint {
#[inline(always)]
pub(crate) fn spin_loop() { // MSRV: std::hint::spin_loop() stabilized in 1.49.0
#[allow(deprecated)]
super::atomic::spin_loop_hint()
}
}

#[derive(Debug)]
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);

Expand Down

0 comments on commit dfcc908

Please sign in to comment.