Skip to content

Writing non-utf8 data to stdout suppresses compiler messages #386

Open
@trentj

Description

@trentj

Here's a simple example:

use std::io::{stdout, Write};
fn main() {
    stdout().write(b"\x91");
}

The only output, in the "Errors" section, is the message Sandbox operation failed: Output was not valid UTF-8: invalid utf-8 sequence of 1 bytes from index 0, which, although true, does not contain any compiler warnings or confirmation that compilation was successful. (At first, I thought this might be a connectivity issue or something of that nature.)

I want to see compiler output regardless of whether there is a problem with the actual program stdout. In this case, if you replace \x91 with some valid UTF-8 string, you see the following in the "Standard Error" section, which was absent in the original example:

   Compiling playground v0.0.1 (file:///playground)
warning: unused `std::result::Result` which must be used
 --> src/main.rs:3:5
  |
3 |     stdout().write(b"\x61");
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_must_use)] on by default
  = note: this `Result` may be an `Err` variant, which should be handled

    Finished dev [unoptimized + debuginfo] target(s) in 1.31s
     Running `target/debug/playground`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe playground isn't doing what it was intended tohelp wantedNot immediately going to be prioritized — ask for mentoring instructions!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions