Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected end of macro invocation when passing no parameters to debug macro. #271

Closed
cedws opened this issue May 21, 2018 · 4 comments
Closed

Comments

@cedws
Copy link

cedws commented May 21, 2018

When I pass no parameters to debug!(), like so,

debug!();

the program will exit with the error unexpected end of macro invocation. The expected behavior is that an empty line should be printed, as it is with println!().

@sfackler
Copy link
Member

I think the situation is a bit different here compared to println as different log lines are more separate than standard output is. Why do you want to log no information?

@cedws
Copy link
Author

cedws commented May 22, 2018

It's an easy way of printing a line break.

@dekellum
Copy link
Contributor

dekellum commented Feb 16, 2019

This might be of more obvious value with #296, e.g. logging with structured values only, and no unstructured message?

Also an obvious workaround with current log is debug!(""), which works as expected.

Logging implementations could still decide, or be configured, to filter both debug!(""), any future supported debug!(), and debug!("\n") for that matter, if these log messages are viewed more as an abuse of the logging system.

@dekellum
Copy link
Contributor

dekellum commented Feb 16, 2019

Also the error message for an empty log macro invocation, is now even stranger than the OP's title, see below. I would imagine, if this should remain a compile time error, that a PR would be favorably considered to improve the error message:

Link to playground:

error: expected identifier, found `,`
 --> src/main.rs:9:5
  |
9 |     info!();
  |     ^^^^^^^^
  |     |
  |     expected identifier
  |     help: remove this comma
  |
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

EFanZh pushed a commit to EFanZh/log that referenced this issue Jul 23, 2023
…tte-5.2.0

Bump miette from 5.1.1 to 5.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants