diff --git a/lib/codegen/src/dbg.rs b/lib/codegen/src/dbg.rs index a514dd7a05..8dd47f625d 100644 --- a/lib/codegen/src/dbg.rs +++ b/lib/codegen/src/dbg.rs @@ -110,6 +110,7 @@ fn open_file() -> io::BufWriter { /// Write a line to the debug trace file if tracing is enabled. /// /// Arguments are the same as for `printf!`. +#[cfg(feature = "std")] #[macro_export] macro_rules! dbg { ($($arg:tt)+) => { @@ -121,6 +122,13 @@ macro_rules! dbg { } } +/// `dbg!` isn't supported in `no_std` mode, so expand it into nothing. +#[cfg(not(feature = "std"))] +#[macro_export] +macro_rules! dbg { + ($($arg:tt)+) => {} +} + /// Helper for printing lists. pub struct DisplayList<'a, T>(pub &'a [T]) where