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

macros fail when format_args is defined in scope #2721

Closed
konstin opened this issue Sep 20, 2023 · 0 comments · Fixed by #2757
Closed

macros fail when format_args is defined in scope #2721

konstin opened this issue Sep 20, 2023 · 0 comments · Fixed by #2757

Comments

@konstin
Copy link

konstin commented Sep 20, 2023

Bug Report

Playground example

We have a custom format_args macro in scope. This causes e.g. warn! to fail:

macro_rules! format_args {
    () => {}
}

fn main() {
    tracing::warn!("oops");
}
error: no rules expected the token `"oops"`
 --> src/main.rs:6:20
  |
1 | macro_rules! format_args {
  | ------------------------ when calling this macro
...
6 |     tracing::warn!("oops");
  |                    ^^^^^^ no rules expected this token in macro call
  |
  = note: while trying to match end of macro

This is caused by format_args! being used in tracing's macros.rs without a qualification to std.

Version

tracing 0.1.37

Platform

n/a

kaffarell added a commit to kaffarell/tracing that referenced this issue Oct 13, 2023
When a custom macro "format_args" is defined, macros such as
`tracing::warn`, `tracing::debug`, etc. will fail. Adding the
full path `::core::format_args!` to the calls fixes this.

Fixes: tokio-rs#2721
kaffarell added a commit to kaffarell/tracing that referenced this issue Oct 13, 2023
When a custom macro "format_args" is defined, macros such as
`tracing::warn`, `tracing::debug`, etc. will fail. Adding the
full path `::core::format_args!` to the calls fixes this.

Fixes: tokio-rs#2721
kaffarell added a commit to kaffarell/tracing that referenced this issue Oct 13, 2023
When a custom macro "format_args" is defined, macros such as
`tracing::warn`, `tracing::debug`, etc. will fail. Adding the
full path `::core::format_args!` to the calls fixes this.

Fixes: tokio-rs#2721
hawkw pushed a commit that referenced this issue Oct 13, 2023
When a custom macro "format_args" is defined, macros such as
`tracing::warn`, `tracing::debug`, etc. will fail. Adding the
full path `::core::format_args!` to the calls fixes this.

Fixes: #2721
hawkw pushed a commit that referenced this issue Oct 13, 2023
When a custom macro "format_args" is defined, macros such as
`tracing::warn`, `tracing::debug`, etc. will fail. Adding the
full path `::core::format_args!` to the calls fixes this.

Fixes: #2721
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

Successfully merging a pull request may close this issue.

1 participant