about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-19 16:52:53 +0100
committerGitHub <noreply@github.com>2025-03-19 16:52:53 +0100
commitce762920140e7a1f75c786b15ed9aa1a345f5cac (patch)
tree4651db22338d16080ce4853756932a635b5bc90d /compiler/rustc_pattern_analysis/src
parentd46cc71f5488681386a3ca32fc8da5bca03264ef (diff)
parent523b9d942890f331fcee5d2d26e7cecfb59c6ec8 (diff)
downloadrust-ce762920140e7a1f75c786b15ed9aa1a345f5cac.tar.gz
rust-ce762920140e7a1f75c786b15ed9aa1a345f5cac.zip
Rollup merge of #137051 - thaliaarchi:io-optional-impls/empty, r=m-ou-se
Implement default methods for `io::Empty` and `io::Sink`

Implements default methods of `io::Read`, `io::BufRead`, and `io::Write` for `io::Empty` and `io::Sink`. These implementations are equivalent to the defaults, except in doing less unnecessary work.

`Read::read_to_string` and `BufRead::read_line` both have a redundant call to `str::from_utf8` which can't be inlined from `core` and `Write::write_all_vectored` has slicing logic which can't be simplified (See on [Compiler Explorer](https://rust.godbolt.org/z/KK6xcrWr4)). The rest are optimized to the minimal with `-C opt-level=3`, but this PR gives that benefit to unoptimized builds.

This includes an implementation of `Write::write_fmt` which just ignores the `fmt::Arguments<'_>`. This could be problematic whenever a user formatting impl is impure, but the docs do not guarantee that the args will be expanded.

Tracked in https://github.com/rust-lang/rust/issues/136756.

r? `@m-ou-se`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions