Skip to content

std::io::Write Trait Not Implemented for &Stdout and &Stderr in bitcoin-io Library Compilation #1

@gladguy

Description

@gladguy

Description

I encountered a build error while compiling a project that depends on the bitcoin-io library. The issue seems to be related to the std::io::Write trait not being implemented for &Stdout and &Stderr.

Steps to Reproduce

Clone the project repository.
Set up the environment and dependencies as described in the project.
Run the following command:
bash
cargo build

Observe the error during the compilation of the bitcoin-io library.

Expected Behavior

The library should compile without errors.

Observed Behavior

Compilation fails with the following error:

error[E0277]: the trait bound &Stdout: std::io::Write is not satisfied
--> src/bridge.rs:291:39
|
291 | std::io::Write::write(self, buf).map_err(Into::into)
| --------------------- ^^^^ the trait std::io::Write is not implemented for &Stdout
| |
| required by a bound introduced by this call
...
The same error occurs for flush and write_all functions as well, both for Stdout and Stderr. These traits are implemented for Stdout and &mut Stdout, but not for &Stdout.

Environment

Rust version: rustc 1.73.0
Cargo version: cargo 1.73.0
OS: Ubuntu 22.04 LTS
bitcoin-io version: 0.1.3
Error Log

Click to view full error log

error[E0277]: the trait bound &Stdout: std::io::Write is not satisfied
--> src/bridge.rs:291:39
|
291 | std::io::Write::write(self, buf).map_err(Into::into)
| --------------------- ^^^^ the trait std::io::Write is not implemented for &Stdout
| |
| required by a bound introduced by this call

error[E0277]: the trait bound &Stdout: std::io::Write is not satisfied
--> src/bridge.rs:291:39
|
291 | std::io::Write::write(self, buf).map_err(Into::into)
| --------------------- ^^^^ the trait std::io::Write is not implemented for &Stdout
| |
| required by a bound introduced by this call
...
430 | / impl_our! {
431 | | impl Write for &'_ std::io::Stdout
432 | | }
| |_- in this macro invocation
|
= help: the trait std::io::Write is implemented for Stdout
= note: std::io::Write is implemented for &mut Stdout, but not for &Stdout
= note: this error originates in the macro impl_our (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound &Stdout: std::io::Write is not satisfied
--> src/bridge.rs:296:39
|
296 | std::io::Write::flush(self).map_err(Into::into)
| --------------------- ^^^^ the trait std::io::Write is not implemented for &Stdout
| |
| required by a bound introduced by this call
...
430 | / impl_our! {
431 | | impl Write for &'_ std::io::Stdout
432 | | }
| |_- in this macro invocation
|
= help: the trait std::io::Write is implemented for Stdout
= note: std::io::Write is implemented for &mut Stdout, but not for &Stdout
= note: this error originates in the macro impl_our (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound &Stdout: std::io::Write is not satisfied
--> src/bridge.rs:301:43
|
301 | std::io::Write::write_all(self, buf).map_err(Into::into)
| ------------------------- ^^^^ the trait std::io::Write is not implemented for &Stdout
| |
| required by a bound introduced by this call
...
430 | / impl_our! {
431 | | impl Write for &'_ std::io::Stdout
432 | | }
| |_- in this macro invocation
|
= help: the trait std::io::Write is implemented for Stdout
= note: std::io::Write is implemented for &mut Stdout, but not for &Stdout
= note: this error originates in the macro impl_our (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound &Stderr: std::io::Write is not satisfied
--> src/bridge.rs:291:39
|
291 | std::io::Write::write(self, buf).map_err(Into::into)
| --------------------- ^^^^ the trait std::io::Write is not implemented for &Stderr
| |
| required by a bound introduced by this call
...
438 | / impl_our! {
439 | | impl Write for &'_ std::io::Stderr
440 | | }
| |_- in this macro invocation
|
= help: the trait std::io::Write is implemented for Stderr
= note: std::io::Write is implemented for &mut Stderr, but not for &Stderr
= note: this error originates in the macro impl_our (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound &Stderr: std::io::Write is not satisfied
--> src/bridge.rs:296:39
|
296 | std::io::Write::flush(self).map_err(Into::into)
| --------------------- ^^^^ the trait std::io::Write is not implemented for &Stderr
| |
| required by a bound introduced by this call
...
438 | / impl_our! {
439 | | impl Write for &'_ std::io::Stderr
440 | | }
| |_- in this macro invocation
|
= help: the trait std::io::Write is implemented for Stderr
= note: std::io::Write is implemented for &mut Stderr, but not for &Stderr
= note: this error originates in the macro impl_our (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound &Stderr: std::io::Write is not satisfied
--> src/bridge.rs:301:43
|
301 | std::io::Write::write_all(self, buf).map_err(Into::into)
| ------------------------- ^^^^ the trait std::io::Write is not implemented for &Stderr
| |
| required by a bound introduced by this call
...
438 | / impl_our! {
439 | | impl Write for &'_ std::io::Stderr
440 | | }
| |_- in this macro invocation
|
= help: the trait std::io::Write is implemented for Stderr
= note: std::io::Write is implemented for &mut Stderr, but not for &Stderr
= note: this error originates in the macro impl_our (in Nightly builds, run with -Z macro-backtrace for more info)

Compiling generic-array v0.14.7
For more information about this error, try rustc --explain E0277.
error: could not compile bitcoin-io (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...

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