Skip to content

record_all! panics if used with incomplete values #3431

@conradludgate

Description

@conradludgate

Bug Report

Version

tracing = "=0.1.43"
tracing-core = "=0.1.35"

Platform

N/A

Crates

tracing, tracing-core.

Description

The following code panics

#[test]
fn tracing_bug() {
    let span = tracing::info_span!("example", foo=1, bar=2);
    tracing::record_all!(span, foo=3);
}

Here's the following stacktrace

assertion `left == right` failed
  left: 1
 right: 2
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/std/src/panicking.rs:698:5
   1: core::panicking::panic_fmt
             at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/panicking.rs:75:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/panicking.rs:394:5
   4: tracing_core::field::FieldSet::value_set_all
             at .cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-core-0.1.35/src/field.rs:945:9
   5: tests::tracing_bug

This seems to be a result of the new valueset! optimisations combined with this new record_all! feature.

I would expect it to work like the following code:

let span = tracing::info_span!("example", foo=1, bar=2);
span.record("foo", 3);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions