Fix the dbg! macro for no_std mode.
Check for the `std` feature outside the macro body rather than inside, so that we get the `std` feature in `cretonne-codegen`, rather than in whatever crate the macro is being expanded in.
This commit is contained in:
@@ -110,6 +110,7 @@ fn open_file() -> io::BufWriter<File> {
|
||||
/// 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
|
||||
|
||||
Reference in New Issue
Block a user