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.
|
/// Write a line to the debug trace file if tracing is enabled.
|
||||||
///
|
///
|
||||||
/// Arguments are the same as for `printf!`.
|
/// Arguments are the same as for `printf!`.
|
||||||
|
#[cfg(feature = "std")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! dbg {
|
macro_rules! dbg {
|
||||||
($($arg:tt)+) => {
|
($($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.
|
/// Helper for printing lists.
|
||||||
pub struct DisplayList<'a, T>(pub &'a [T])
|
pub struct DisplayList<'a, T>(pub &'a [T])
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user