Skip to content

Commit 38da7ea

Browse files
authored
tracing: fix issues compiling for WASM/other <=32-bit platforms (#2060)
This changes the "unregistered" interest state from `0xDEADFACED` to`0xDEAD`, which should fit in a `usize` even on 16-bit platforms. The actual value of this thing doesn't matter at all, it just has to be "not 0, 1, or 2", and it's good for it to be something weird to make it more obvious in the event of stuff going wrong. This should fix a warning being emitted when building for wasm (and other <=32-bit platforms) because the previous literal would be truncated. Also, the `wasm_bindgen_test` macro apparently messes with the `macros_redefined_core` tests, so skip them on wasm.
1 parent 8f240e6 commit 38da7ea

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

tracing/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ pub mod __macro_support {
10051005
/// without warning.
10061006
pub const fn new(meta: &'static Metadata<'static>) -> Self {
10071007
Self {
1008-
interest: AtomicUsize::new(0xDEADFACED),
1008+
interest: AtomicUsize::new(0xDEAD),
10091009
meta,
10101010
registration: Once::new(),
10111011
}

tracing/tests/macros_redefined_core.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@ extern crate self as core;
22

33
use tracing::{enabled, event, span, Level};
44

5-
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
65
#[test]
76
fn span() {
87
span!(Level::DEBUG, "foo");
98
}
109

11-
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
1210
#[test]
1311
fn event() {
1412
event!(Level::DEBUG, "foo");
1513
}
1614

17-
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
1815
#[test]
1916
fn enabled() {
2017
enabled!(Level::DEBUG);

0 commit comments

Comments
 (0)