Skip to content

Commit 7433a2a

Browse files
committed
Fix macro scope
1 parent 42fca3d commit 7433a2a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/util/log.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,33 @@
1111
// macros such as `log::info!` from the IDE.
1212
use the_log_crate;
1313

14-
pub use the_log_crate::{error, info, warn};
14+
pub(crate) use the_log_crate::{error, info, warn};
1515

1616
cfg_if::cfg_if! {
1717
if #[cfg(all(not(debug_assertions), not(feature = "hot_log")))] {
1818
// If it is release build and the feature "hot_log" is not enabled,
1919
// then we define verbose logs as no-op in release build.
2020

21-
/// The `log::debug!` macro is disabled in release build. Use the "hot_log" feature to enable.
22-
#[cfg(not(feature = "hot_log"))]
21+
/// The `log::debug!` macro is disabled in release build.
22+
/// Use the "hot_log" feature to enable.
2323
macro_rules! debug {
24-
(target: $target:expr, $($arg:tt)+) => {};
2524
($($arg:tt)+) => {}
2625
}
2726

28-
/// The `log::trace!` macro is disabled in release build. Use the "hot_log" feature to enable.
29-
#[cfg(not(feature = "hot_log"))]
27+
/// The `log::trace!` macro is disabled in release build.
28+
/// Use the "hot_log" feature to enable.
3029
macro_rules! trace {
31-
(target: $target:expr, $($arg:tt)+) => {};
3230
($($arg:tt)+) => {}
3331
}
3432

33+
// By default, a macro has no path-based scope.
34+
// The following allows other modules to access the macros with `crate::util::log::debug`
35+
// and `crate::util::log::trace`.
36+
pub(crate) use debug;
37+
pub(crate) use trace;
38+
3539
} else {
3640
// Otherwise simply import the macros from the `log` crate.
37-
pub use the_log_crate::{debug, trace};
41+
pub(crate) use the_log_crate::{debug, trace};
3842
}
3943
}

src/util/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ pub mod heap;
2626
pub mod is_mmtk_object;
2727
/// Linear scan through a heap range
2828
pub mod linear_scan;
29-
/// Logging
30-
pub mod log;
3129
/// Various malloc implementations (conditionally compiled by features)
3230
pub mod malloc;
3331
/// Wrapper functions for memory syscalls such as mmap, mprotect, etc.
@@ -53,6 +51,8 @@ pub(crate) mod epilogue;
5351
pub(crate) mod erase_vm;
5452
/// Finalization implementation.
5553
pub(crate) mod finalizable_processor;
54+
/// Logging wrappers
55+
pub(crate) mod log;
5656
/// Logger initialization
5757
pub(crate) mod logger;
5858
pub(crate) mod object_enum;

0 commit comments

Comments
 (0)