Skip to content

Commit 06d0d5f

Browse files
committed
core: Switch to unconditional no_std
1 parent e63ef57 commit 06d0d5f

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

tracing-core/src/callsite.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ mod private {
516516
#[cfg(feature = "std")]
517517
mod dispatchers {
518518
use crate::{dispatcher, lazy::Lazy};
519+
use alloc::vec::Vec;
519520
use std::sync::{
520521
atomic::{AtomicBool, Ordering},
521522
RwLock, RwLockReadGuard, RwLockWriteGuard,

tracing-core/src/dispatcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
//! [`get_default`] function, which executes a closure with a reference to the
123123
//! currently default `Dispatch`. This is used primarily by `tracing`
124124
//! instrumentation.
125-
//!
125+
126126
use core::ptr::addr_of;
127127

128128
use crate::{
@@ -182,7 +182,7 @@ enum Kind<T> {
182182
}
183183

184184
#[cfg(feature = "std")]
185-
thread_local! {
185+
std::thread_local! {
186186
static CURRENT_STATE: State = const {
187187
State {
188188
default: RefCell::new(None),

tracing-core/src/field.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,9 @@ mod private {
11201120

11211121
#[cfg(test)]
11221122
mod test {
1123+
use alloc::boxed::Box;
1124+
use std::format;
1125+
11231126
use super::*;
11241127
use crate::metadata::{Kind, Level, Metadata};
11251128
use crate::stdlib::{borrow::ToOwned, string::String};

tracing-core/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@
116116
//! [`Dispatch`]: dispatcher::Dispatch
117117
//! [`tokio-rs/tracing`]: https://github.com/tokio-rs/tracing
118118
//! [`tracing`]: https://crates.io/crates/tracing
119+
120+
#![no_std]
119121
#![doc(
120122
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/tracing/main/assets/logo-type.png",
121123
issue_tracker_base_url = "https://github.com/tokio-rs/tracing/issues/"
122124
)]
123-
#![cfg_attr(not(feature = "std"), no_std)]
124125
#![cfg_attr(docsrs, feature(doc_cfg), deny(rustdoc::broken_intra_doc_links))]
125126
#![warn(
126127
missing_debug_implementations,
@@ -144,9 +145,12 @@
144145
unused_parens,
145146
while_true
146147
)]
147-
#[cfg(not(feature = "std"))]
148+
148149
extern crate alloc;
149150

151+
#[cfg(feature = "std")]
152+
extern crate std;
153+
150154
#[doc(hidden)]
151155
pub mod __macro_support {
152156
// Re-export the `core` functions that are used in macros. This allows

0 commit comments

Comments
 (0)