Document why cannot use concat! in dbg!
Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
This commit is contained in:
parent
a4cbb44ae2
commit
d0c1405564
1 changed files with 4 additions and 0 deletions
|
@ -282,6 +282,10 @@ macro_rules! eprintln {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[stable(feature = "dbg_macro", since = "1.32.0")]
|
#[stable(feature = "dbg_macro", since = "1.32.0")]
|
||||||
macro_rules! dbg {
|
macro_rules! dbg {
|
||||||
|
// NOTE: We cannot use `concat!` to make a static string as a format argument
|
||||||
|
// of `eprintln!` because `file!` could contain a `{` or
|
||||||
|
// `$val` expression could be a block (`{ .. }`), in which case the `eprintln!`
|
||||||
|
// will be malformed.
|
||||||
() => {
|
() => {
|
||||||
$crate::eprintln!("[{}:{}]", $crate::file!(), $crate::line!());
|
$crate::eprintln!("[{}:{}]", $crate::file!(), $crate::line!());
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue