Skip to content

Commit fbb0c31

Browse files
authored
Rollup merge of rust-lang#102781 - StackOverflowExcept1on:master, r=joshtriplett
Improved documentation for `std::io::Error`
2 parents f72d76d + f95e853 commit fbb0c31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/std/src/io/error.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ impl Error {
481481
/// originate from the OS itself. The `error` argument is an arbitrary
482482
/// payload which will be contained in this [`Error`].
483483
///
484+
/// Note that this function allocates memory on the heap.
484485
/// If no extra payload is required, use the `From` conversion from
485486
/// `ErrorKind`.
486487
///
@@ -495,7 +496,7 @@ impl Error {
495496
/// // errors can also be created from other errors
496497
/// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
497498
///
498-
/// // creating an error without payload
499+
/// // creating an error without payload (and without memory allocation)
499500
/// let eof_error = Error::from(ErrorKind::UnexpectedEof);
500501
/// ```
501502
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)