`debug_print(ln)` fails for temporary values
After https://github.com/paritytech/ink/pull/1258, the debug_print(ln)! macro fails for temporary variables if the "ink-debug" feature is disabled.
I can't reproduce. Building this example with:
cargo +nightly contract build --release
This should disable this feature. The CI would have also caught this error. Can you give more instructions?
You need to remove "ink-debug" from Cargo.toml=)
Ahh okay it shouldn't be there. I think it is a left over. Can reproduce it now.
Can't reproduce the issue with the latest ink! 4.0 release. ink-debug seems not to be in Cargo.toml
Looked into it. So the story with ink-debug is that if you execute cargo contract build the default behavior is that cargo-contract builds the contract with --features=ink/ink-debug. That's the reason why the Cargo.toml of the contract-transfer example doesn't need to contain any ink-debug feature anymore.
If you build the contract with cargo contract build --release the debug_print and debug_println macros won't output whatever was passed to them:
if #[cfg(any(feature = "ink-debug", feature = "std"))] {
…
} else {
#[macro_export]
/// Debug messages disabled. Enable the `ink-debug` feature for contract debugging.
macro_rules! debug_print {
($($arg:tt)*) => ();
}
#[macro_export]
/// Debug messages disabled. Enable the `ink-debug` feature for contract debugging.
macro_rules! debug_println {
() => ();
($($arg:tt)*) => ();
}
}
(from https://github.com/paritytech/ink/blob/master/crates/env/src/lib.rs).
Hence the bug can no longer occur, as what was a temporary variable in Green's original issue report is swallowed by the macros in case the feature is not enabled.