rust-lang / rust-lang/rust-playground
Writing non-utf8 data to stdout suppresses compiler messages
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 267
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 6
Description
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`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the linked Rust Playground example as the reproduction, first comparing its output with the valid UTF-8 variant shown in the issue. Trace how compiler stderr and program stdout are combined or reported, and consider the issue done when compiler messages remain visible even when program stdout is invalid UTF-8.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100