File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -440,12 +440,18 @@ impl Error {
440
440
/// `GetLastError` on Windows) and will return a corresponding instance of
441
441
/// [`Error`] for the error code.
442
442
///
443
+ /// This should be called immediately after a call to a platform function,
444
+ /// otherwise the state of the error value is indeterminate. In particular,
445
+ /// other standard library functions may call platform functions that may
446
+ /// (or may not) reset the error value even if they succeed.
447
+ ///
443
448
/// # Examples
444
449
///
445
450
/// ```
446
451
/// use std::io::Error;
447
452
///
448
- /// println!("last OS error: {:?}", Error::last_os_error());
453
+ /// let os_error = Error::last_os_error();
454
+ /// println!("last OS error: {:?}", os_error);
449
455
/// ```
450
456
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
451
457
#[ must_use]
You can’t perform that action at this time.
0 commit comments