File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -440,12 +440,18 @@ impl Error {
440440 /// `GetLastError` on Windows) and will return a corresponding instance of
441441 /// [`Error`] for the error code.
442442 ///
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+ ///
443448 /// # Examples
444449 ///
445450 /// ```
446451 /// use std::io::Error;
447452 ///
448- /// println!("last OS error: {:?}", Error::last_os_error());
453+ /// let os_error = Error::last_os_error();
454+ /// println!("last OS error: {:?}", os_error);
449455 /// ```
450456 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
451457 #[ must_use]
You can’t perform that action at this time.
0 commit comments