Skip to content

Regression between 2.7.0 and 2.8.1 around # operator in slog macros (tuple struct constructor ErrorTagWrapper is private) #364

@Manishearth

Description

@Manishearth
use std::io::Error;
use slog::Logger;

fn repro(log: Logger) {
    let err = Error::other("some error");
    slog::info!(log, "oops"; "err" => #err);
}

This compiles successfully on 2.7.0, but fails on 2.8.1 with this error:

    Checking slog-test v0.1.0 (/home/manishearth/sand/crates/slog-test)
error[E0603]: tuple struct constructor `ErrorTagWrapper` is private
    --> /home/manishearth/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/slog-2.8.1/src/lib.rs:920:25
     |
 920 |         let w = $crate::ErrorTagWrapper(v);
     |                         ^^^^^^^^^^^^^^^ private tuple struct constructor
...
3544 | pub struct ErrorTagWrapper<E>(E);
     |                               - a constructor is private if any of the fields is private
     |
    ::: src/lib.rs:6:5
     |
   6 |     slog::info!(log, "oops"; "err" => #err);
     |     --------------------------------------- tuple struct `ErrorTagWrapper` is not publicly re-exported
     |
note: the tuple struct constructor `ErrorTagWrapper` is defined here
    --> /home/manishearth/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/slog-2.8.1/src/lib.rs:3544:1
     |
3544 | pub struct ErrorTagWrapper<E>(E);
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0616]: field `0` of struct `ErrorTagWrapper` is private
 --> src/lib.rs:6:5
  |
6 |     slog::info!(log, "oops"; "err" => #err);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private field
  |
  = note: this error originates in the macro `$crate::__builtin` which comes from the expansion of the macro `slog::info` (in Nightly builds, run with -Z macro-backtrace for more info)

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