One uses this to send output to stdout:
println!(\"some output\")
I think there is no corresponding macro to do the same for stderr.
stderr!("Code {}: Danger, Will Robinson! Danger!", 42);
The other answers generate an unused import warning with the latest nightly, so here's a modern macro that Just Works TM.
macro_rules! stderr {
($($arg:tt)*) => (
use std::io::Write;
match writeln!(&mut ::std::io::stderr(), $($arg)* ) {
Ok(_) => {},
Err(x) => panic!("Unable to write to stderr (file handle closed?): {}", x),
}
)
}