Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure formatter errors are emitted by the default Write::write_fmt #31904

Merged
merged 1 commit into from
Feb 26, 2016

Conversation

bluss
Copy link
Member

@bluss bluss commented Feb 26, 2016

Make sure formatter errors are emitted by the default Write::write_fmt

Previously, if an error was returned from the formatter that did not
originate in an underlying writer error, Write::write_fmt would return
successfully even if the formatting did not complete (was interrupted by
an fmt::Error return).

Now we choose to emit an io::Error with kind Other for formatter errors.

Since this may reveal error returns from write!() and similar that
previously passed silently, it's a kind of a [breaking-change].

Fixes #31879

Previously, if an error was returned from the formatter that did not
originate in an underlying writer error, Write::write_fmt would return
successfully even if the formatting did not complete (was interrupted by
an `fmt::Error` return).

Now we choose to emit an io::Error with kind Other for formatter errors.

Since this may reveal error returns from `write!()` and similar that
previously passed silently, it's a kind of a [breaking-change].
@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@bluss
Copy link
Member Author

bluss commented Feb 26, 2016

I now realized I didn't consider the possibility of adding new ErrorKinds (I have no idea when that is appropriate).

@alexcrichton
Copy link
Member

Yeah I think the use of ErrorKind::Other here is fine, thanks @bluss!

@bors: r+ 6cfafad

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 26, 2016
…xcrichton

Make sure formatter errors are emitted by the default Write::write_fmt

Previously, if an error was returned from the formatter that did not
originate in an underlying writer error, Write::write_fmt would return
successfully even if the formatting did not complete (was interrupted by
an `fmt::Error` return).

Now we choose to emit an io::Error with kind Other for formatter errors.

Since this may reveal error returns from `write!()` and similar that
previously passed silently, it's a kind of a [breaking-change].

Fixes rust-lang#31879
bors added a commit that referenced this pull request Feb 26, 2016
@bors bors merged commit 6cfafad into rust-lang:master Feb 26, 2016
@bluss bluss deleted the writer-formatter-error branch February 26, 2016 13:53
@bluss bluss added the relnotes Marks issues that should be documented in the release notes of the next release. label Feb 26, 2016
@bluss
Copy link
Member Author

bluss commented Feb 26, 2016

Small relnote: Correctly emits formatter errors from write!() and writeln!() where it could previously pass silently. (on the other hand, I/O errors were always emitted correctly, so this is kind of a minor thing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants