Skip to content

Commit 7e725d5

Browse files
committed
tracing: simplify level event macros
The level event macros (e.g. `trace!`, `info!`) call into the `event!` macro with the level set appropriately. However, these macros have become complex, covering many different cases and reaching aroudn 250 lines of patterns. As discovered in #3437, there were many cases where these level event macros didn't correctly handle patterns which the `event!` macro does handle. This change simplifies the event macros to delegate more parsing to the common `event!` macro patterns. Rather than matching all the possible field patterns, the level event macros only match the directives (name, target, and parent or some combination thereof). The remainder of the macro invocation is matched as a token tree (`tt`) and passed as is to the `event!` macro. This reduces the patterns to only the 8 combinations of directives (including no directives at all), reducing the previous 250 lines of patterns for each macro down to around 25 lines instead. Additionally, an unqualified use of `Some` in the `valueset` macro has been fixed, as this affected all event macros (`event!` and all the level event macros). With these changes, the comprehensive checks introduced in #3437 now all pass and so the job can be fully enabled to fail on CI.
1 parent 3fbc0b9 commit 7e725d5

File tree

3 files changed

+211
-1314
lines changed

3 files changed

+211
-1314
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ jobs:
325325
- name: "Generate macro tests"
326326
run: cargo run --bin xtask -- gen-macro-tests
327327
- name: "Check tracing macro invocations ("
328-
# TODO(hds): remove `|| true` when all macros compile
329-
run: cargo check --tests || true
328+
run: cargo check --tests
330329
working-directory: "tracing/test-macros"
331330

332331
# all required checks except for the main test run (which we only require

0 commit comments

Comments
 (0)