Skip to content

Commit

Permalink
Merge branch 'master' into feat/stable-kv-internals
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Apr 10, 2023
2 parents 8311727 + 474699a commit ef94087
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 61 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Expand Up @@ -127,8 +127,11 @@ jobs:
- uses: actions/checkout@master
- name: Install Rust
run: |
rustup update 1.31.0 --no-self-update
rustup default 1.31.0
rustup update 1.60.0 --no-self-update
rustup default 1.60.0
- run: cargo build --verbose
- run: cargo build --verbose --features serde
- run: cargo build --verbose --features std
- run: cargo test --verbose --manifest-path tests/Cargo.toml

embedded:
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -13,7 +13,6 @@ A lightweight logging facade for Rust
categories = ["development-tools::debugging"]
keywords = ["logging"]
exclude = ["rfcs/**/*"]
build = "build.rs"

[package.metadata.docs.rs]
features = ["std", "serde", "kv_unstable_std", "kv_unstable_sval", "kv_unstable_serde"]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -18,7 +18,7 @@ implementation that is most suitable for its use case.

## Minimum supported `rustc`

`1.31.0+`
`1.60.0+`

This version is explicitly tested in CI and may be bumped in any release as needed. Maintaining compatibility with older compilers is a priority though, so the bar for bumping the minimum supported version is set very high. Any changes to the supported minimum version will be called out in the release notes.

Expand Down Expand Up @@ -67,6 +67,7 @@ There are many available implementations to choose from, here are some of the mo
* [`pretty_env_logger`](https://docs.rs/pretty_env_logger/*/pretty_env_logger/)
* [`stderrlog`](https://docs.rs/stderrlog/*/stderrlog/)
* [`flexi_logger`](https://docs.rs/flexi_logger/*/flexi_logger/)
* [`call_logger`](https://docs.rs/call_logger/*/call_logger/)
* Complex configurable frameworks:
* [`log4rs`](https://docs.rs/log4rs/*/log4rs/)
* [`fern`](https://docs.rs/fern/*/fern/)
Expand Down
46 changes: 0 additions & 46 deletions build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion clippy.toml
@@ -1 +1 @@
msrv = "1.31.0"
msrv = "1.60.0"
22 changes: 12 additions & 10 deletions src/lib.rs
Expand Up @@ -136,6 +136,7 @@
//! * [pretty_env_logger]
//! * [stderrlog]
//! * [flexi_logger]
//! * [call_logger]
//! * Complex configurable frameworks:
//! * [log4rs]
//! * [fern]
Expand Down Expand Up @@ -302,6 +303,7 @@
//! [pretty_env_logger]: https://docs.rs/pretty_env_logger/*/pretty_env_logger/
//! [stderrlog]: https://docs.rs/stderrlog/*/stderrlog/
//! [flexi_logger]: https://docs.rs/flexi_logger/*/flexi_logger/
//! [call_logger]: https://docs.rs/call_logger/*/call_logger/
//! [syslog]: https://docs.rs/syslog/*/syslog/
//! [slog-stdlog]: https://docs.rs/slog-stdlog/*/slog_stdlog/
//! [log4rs]: https://docs.rs/log4rs/*/log4rs/
Expand Down Expand Up @@ -342,20 +344,20 @@ mod serde;
#[cfg(feature = "kv_unstable")]
pub mod kv;

#[cfg(has_atomics)]
#[cfg(target_has_atomic = "ptr")]
use std::sync::atomic::{AtomicUsize, Ordering};

#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
use std::cell::Cell;
#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
use std::sync::atomic::Ordering;

#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
struct AtomicUsize {
v: Cell<usize>,
}

#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
impl AtomicUsize {
const fn new(v: usize) -> AtomicUsize {
AtomicUsize { v: Cell::new(v) }
Expand All @@ -369,7 +371,7 @@ impl AtomicUsize {
self.v.set(val)
}

#[cfg(atomic_cas)]
#[cfg(target_has_atomic = "ptr")]
fn compare_exchange(
&self,
current: usize,
Expand All @@ -387,7 +389,7 @@ impl AtomicUsize {

// Any platform without atomics is unlikely to have multiple cores, so
// writing via Cell will not be a race condition.
#[cfg(not(has_atomics))]
#[cfg(not(target_has_atomic = "ptr"))]
unsafe impl Sync for AtomicUsize {}

// The LOGGER static holds a pointer to the global logger. It is protected by
Expand Down Expand Up @@ -1256,7 +1258,7 @@ pub fn max_level() -> LevelFilter {
/// An error is returned if a logger has already been set.
///
/// [`set_logger`]: fn.set_logger.html
#[cfg(all(feature = "std", atomic_cas))]
#[cfg(all(feature = "std", target_has_atomic = "ptr"))]
pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError> {
set_logger_inner(|| Box::leak(logger))
}
Expand Down Expand Up @@ -1314,12 +1316,12 @@ pub fn set_boxed_logger(logger: Box<dyn Log>) -> Result<(), SetLoggerError> {
/// ```
///
/// [`set_logger_racy`]: fn.set_logger_racy.html
#[cfg(atomic_cas)]
#[cfg(target_has_atomic = "ptr")]
pub fn set_logger(logger: &'static dyn Log) -> Result<(), SetLoggerError> {
set_logger_inner(|| logger)
}

#[cfg(atomic_cas)]
#[cfg(target_has_atomic = "ptr")]
fn set_logger_inner<F>(make_logger: F) -> Result<(), SetLoggerError>
where
F: FnOnce() -> &'static dyn Log,
Expand Down

0 comments on commit ef94087

Please sign in to comment.