summary refs log tree commit diff
path: root/library/std/src/io
AgeCommit message (Collapse)AuthorLines
2025-02-17update version placeholdersJosh Stone-2/+2
2025-02-14Forward all default methods for I/O implsThalia Archibald-0/+62
2025-02-13Use `slice::fill` in `io::Repeat` implementationDaniPopes-18/+10
Use the existing `fill` methods on slices instead of manually writing the fill loop.
2025-02-12Rollup merge of #136945 - samueltardieu:push-rsqlyknnvyqm, r=fmeaseJacob Pratt-0/+1
Add diagnostic item for `std::io::BufRead` This will be used in Clippy to detect unbuffered calls to `Read::bytes()`.
2025-02-12Add diagnostic item for `std::io::BufRead`Samuel Tardieu-0/+1
This will be used in Clippy to detect unbuffered calls to `Read::bytes()`.
2025-02-10Implement `read*_exact` for `std:io::repeat`Benoît du Garreau-0/+11
cc #136756
2025-02-09Auto merge of #136751 - bjorn3:update_rustfmt, r=Mark-Simulacrumbors-3/+4
Update bootstrap compiler and rustfmt The rustfmt version we previously used formats things differently from what the latest nightly rustfmt does. This causes issues for subtrees that get formatted both in-tree and in their own repo. Updating the rustfmt used in-tree solves those issues. Also bumped the bootstrap compiler as the stage0 update command always updates both at the same time.
2025-02-08Rustfmtbjorn3-3/+4
2025-02-08Rollup merge of #135696 - joboet:move_pal_io, r=NoratriebMatthias Krüger-1/+1
std: move `io` module out of `pal`, get rid of `sys_common::io` Part of #117276. This does two related things: 1. It moves the platform-specific definitions for `IoSlice`, `IoSliceMut` and `is_terminal` out of `pal` and into `sys` and unifies some of them. 2. It gets rid of `sys_common::io`, moving the non-platform-specific test helpers into `std::test_helpers` and the buffer size definition to the new `sys::io` module.
2025-02-07std: get rid of `sys_common::io`joboet-1/+1
2025-02-06Stabilise 'Cursor::{get_mut, set_position}' in 'const' scenarios;Gabriel Bjørnager Jensen-2/+2
2025-01-26Test pipes also when not running on Windows and Linux simultaneouslyTobias Bucher-1/+1
Fixes https://github.com/rust-lang/rust/pull/135635#pullrequestreview-2574184488.
2025-01-26Update `std::io::{pipe, PipeReader, PipeWriter}` docs the new locationTobias Bucher-16/+20
Also create a section "Platform-specific behavior", don't hide required imports for code examples.
2025-01-26Move `std::io::pipe` code into its own fileTobias Bucher-272/+277
2025-01-25Rollup merge of #135948 - bjorn3:update_emscripten_std_tests, r=Mark-SimulacrumJacob Pratt-2/+1
Update emscripten std tests This disables a bunch of emscripten tests that test things emscripten doesn't support and re-enables a whole bunch of tests which now work just fine on emscripten. Tested with `EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" ./x.py test library/ --target wasm32-unknown-emscripten`.
2025-01-25Improve and expand documentation of pipesJosh Triplett-8/+14
- Simplify some of the language - Minor grammar fixes - Don't imply that pipes *only* work across multiple processes; instead, *suggest* that they're typically used across two or more separate processes. - Specify that portable applications cannot use multiple readers or multiple writers for messages larger than a byte, due to potential interleaving. - Remove no-longer-referenced footnote URLs.
2025-01-24Remove a bunch of emscripten test ignoresbjorn3-2/+0
They are either outdated as emscripten now supports i128 or they are subsumed by #[cfg_attr(not(panic = "unwind"), ignore]
2025-01-24Fix testing of the standard library with Emscriptenbjorn3-0/+1
This does need EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" avoid several OOMs.
2025-01-17Move `std::pipe::*` into `std::io`Jiahao XU-0/+266
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-01-11Add inherent versions of MaybeUninit methods for slicesltdk-1/+1
2025-01-10Use `NonNull::without_provenance` within the standard librarySamuel Tardieu-3/+4
This API removes the need for several `unsafe` blocks, and leads to clearer code.
2025-01-08update version placeholdersPietro Albini-2/+2
2024-12-21Avoid short writes in LineWriterChris Denton-6/+21
Also update the tests to avoid testing implementation details.
2024-12-21Less unwrap() in documentationKornel-10/+15
2024-12-06Rollup merge of #130254 - GrigorenkoPV:QuotaExceeded, r=dtolnayMatthias Krüger-9/+9
Stabilize `std::io::ErrorKind::QuotaExceeded` Also drop "Filesystem" from its name. See #130190 for more info. FCP in #130190 cc #86442 r? `@dtolnay`
2024-12-06Rollup merge of #130209 - GrigorenkoPV:CrossesDevices, r=dtolnayMatthias Krüger-1/+1
Stabilize `std::io::ErrorKind::CrossesDevices` FCP in #130191 cc #86442 See #130191 for more info and a recap of what has happened up until now. TLDR: This had been FCP'd in December 2022 with some other `ErrorKind`s, but the stabilization got postponed due to some concerns voiced about several of the variants. However, the only concern ever voiced for this variant in particular was a wish to rename this to `NotSameDevice` analogous to Windows's `ERROR_NOT_SAME_DEVICE` (as opposed to Unix's `EXDEV`). This suggestion did not receive any support. So let's try to FCP this as is. r? libs-api
2024-12-01add isatty alias for is_terminalcod10129-0/+1
2024-11-26std: update internal uses of `io::const_error!`joboet-21/+21
2024-11-25std: expose `const_io_error!` as `const_error!`joboet-20/+36
ACP: rust-lang/libs-team#205 Tracking issue: #133448
2024-11-20Rollup merge of #130800 - bjoernager:const-mut-cursor, r=joshtriplettMatthias Krüger-2/+4
Mark `get_mut` and `set_position` in `std::io::Cursor` as const. Relevant tracking issue: #130801 The methods `get_mut` and `set_position` can trivially be marked as const due to #57349 being stabilised.
2024-11-14Rollup merge of #132790 - aDotInTheVoid:ioslice-asslice-rides-again, r=cuviperJubilee-0/+59
Add as_slice/into_slice for IoSlice/IoSliceMut. ACP: https://github.com/rust-lang/libs-team/issues/93 Tracking issue: #132818 Based on a623c5233ae7f6b540e5c00f2be02f40b33b0793 (CC `@mpdn)` and #111277 (CC `@Lucretiel).` Closes: #124659 Tracking Issue: TODO try-job: test-various try-job: dist-various-1 try-job: dist-various-2 r? libs
2024-11-09Add as_slice/into_slice for IoSlice/IoSliceMut.Alona Enraght-Moony-0/+59
Co-authored-by: Mike Pedersen <mike@mikepedersen.dk> Co-authored-by: Nathan West <Lucretiel@gmail.com>
2024-11-08update io::Error::into_inner to acknowlage io::Error::otherbinarycat-2/+4
2024-10-23Specialize `read_exact` and `read_buf_exact` for `VecDeque`Benoît du Garreau-0/+46
2024-10-15replace placeholder versionJosh Stone-17/+17
(cherry picked from commit 567fd9610cbfd220844443487059335d7e1ff021)
2024-10-10More clearly document Stdin::read_lineTim (Theemathas) Chirananthavat-1/+6
These are common pitfalls for beginners, so I think it's worth making the subtleties more visible.
2024-10-05Unbreak tidyPavel Grigorenko-5/+5
2024-10-05Stabilize `std::io::ErrorKind::QuotaExceeded`Pavel Grigorenko-5/+5
Also drop "Filesystem" from its name
2024-10-04Stabilize `BufRead::skip_until`okaneco-3/+1
2024-10-02Add `get_line` confusable to `Stdin::read_line()`Jaken Herman-0/+1
Add tests for addition of `#[rustc_confusables("get_line")]`
2024-09-30Rollup merge of #130914 - compiler-errors:insignificant-dtor, r=AmanieuTrevor Gross-0/+1
Mark some more types as having insignificant dtor These were caught by https://github.com/rust-lang/rust/pull/129864#issuecomment-2376658407, which is implementing a lint for some changes in drop order for temporaries in tail expressions. Specifically, the destructors of `CString` and the bitpacked repr for `std::io::Error` are insignificant insofar as they don't have side-effects on things like locking or synchronization; they just free memory. See some discussion on #89144 for what makes a drop impl "significant"
2024-09-29Fix std tests for wasm32-wasip2 targetNicola Krumschmidt-5/+6
2024-09-28Rollup merge of #125404 - a1phyr:fix-read_buf-uses, r=workingjubileeMatthias Krüger-16/+88
Fix `read_buf` uses in `std` Following lib-team decision here: https://github.com/rust-lang/rust/issues/78485#issuecomment-2122992314 Guard against the pathological behavior of both returning an error and performing a read.
2024-09-27Mark some more types as having insignificant dtorMichael Goulet-0/+1
2024-09-25Add tracking issue for io_error_inprogressnora-1/+1
2024-09-25Auto merge of #130803 - cuviper:file-buffered, r=joshtriplettbors-1/+29
Add `File` constructors that return files wrapped with a buffer In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers. ACP: https://github.com/rust-lang/libs-team/issues/446 Tracking Issue: #130804
2024-09-24Mark 'get_mut' and 'set_position' in 'std::io::Cursor' as const;Gabriel Bjørnager Jensen-2/+4
2024-09-24Pre-allocate buffers in `File::open_buffered` and `create_buffered`Josh Stone-1/+29
2024-09-24add InProgress ErrorKind gated behind io_error_inprogress featureAviram Hassan-0/+7
Co-authored-by: David Tolnay <dtolnay@gmail.com> Co-authored-by: nora <48135649+Noratrieb@users.noreply.github.com>
2024-09-23Add a comment to `Read::read_buf`Benoît du Garreau-0/+2