cortex-m-semihosting: make semihosting macros compatible with 1-arg format strings#591
Conversation
ff40d55 to
8c2f5ad
Compare
| }; | ||
| ($s:expr, $($tt:tt)*) => { | ||
| $crate::export::hstderr_fmt(format_args!(concat!($s, "\n"), $($tt)*)) | ||
| $crate::export::hstderr_fmt(format_args!("{}\n", format_args!($s, $($tt)*))) |
There was a problem hiding this comment.
Is the double nested format_args! required here? Was there some use case that didn't work with the previous method of using concat!?
There was a problem hiding this comment.
Yes, sorry I meant to take a note of it - format_args! doesn't expand captures in the format string literal if it is generated by a macro:
From rust-lang/rust#106824, it should get flattened into a single format_args!/Arguments call.
There was a problem hiding this comment.
yikes - thanks for the clarification.
|
As a point of reference, the semihosting crate does it like this: https://docs.rs/semihosting/0.1.18/src/semihosting/macros.rs.html. You could make the argument we should deprecate this crate and recommend people use that one. |
|
Anything else I need to do on this PR? |
|
No, it's all good. I was just letting others have a chance to weigh in. |
Fixes #581