Skip to main content

dbg_internal

Macro dbg_internal 

Source
#[doc(hidden)]
pub macro dbg_internal { (($($piece:literal),+) ($($processed:expr => $bound:ident),+) ()) => { ... }, (($($piece:literal),*) ($($processed:expr => $bound:ident),*) ($val:expr $(,$rest:expr)*)) => { ... }, }
🔬This is a nightly-only experimental API. (std_internals)
Expand description

Internal macro that processes a list of expressions, binds their results with match, calls eprint! with the collected information, and returns all the evaluated expressions in a tuple.

E.g. dbg_internal!(() () (1, 2)) expands into

match (1, 2) {
    args => {
        let (tmp_1, tmp_2) = args;
        eprint!("...", &tmp_1, &tmp_2, /* some other arguments */);
        (tmp_1, tmp_2)
    }
}

This is necessary so that dbg! outputs don’t get torn, see #136703.