#![feature(format_args_capture)] support #445
Labels
No labels
bug
duplicate
easy
enhancement
help wanted
invalid
question
rfc
structured-logging
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-rust-lang/log#445
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It would be great if this crate supports
#![feature(format_args_capture)]. It currently does not (playground):The above program logs
{x}withoutunused-variableswarning becauselog!treats single argument specially and uses__log_format_args!to validate the argument:github.com/rust-lang/log@1cd39c01fd/src/macros.rs (L35-L36)I don't understand why
log!treats single argument specially. The__private_api_logcode path and__private_api_log_litpath should do the same thing (both of them constructfmt::Arguments):github.com/rust-lang/log@1cd39c01fd/src/lib.rs (L1481)github.com/rust-lang/log@1cd39c01fd/src/lib.rs (L1462)If the (redundant?) single argument special treatment is removed,
#![feature(format_args_capture)]will be supported.That is not a breaking change because(edit: not totally true → #407).log!already uses__log_format_args!to validate the argumentI'd like to help if this request is accepted.
That special case existed to minimize the amount of code generated, but it's not compatible with format_args_capture as you pointed out. It should just be removed.