File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ impl AsFd for Stdin {
3434impl < ' a > AsFd for io:: StdinLock < ' a > {
3535 #[ inline]
3636 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
37+ // SAFETY: user code should not close stdin out from under the standard library
3738 unsafe { BorrowedFd :: borrow_raw ( 0 ) }
3839 }
3940}
@@ -77,6 +78,7 @@ impl AsFd for Stdout {
7778impl < ' a > AsFd for io:: StdoutLock < ' a > {
7879 #[ inline]
7980 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
81+ // SAFETY: user code should not close stdout out from under the standard library
8082 unsafe { BorrowedFd :: borrow_raw ( 1 ) }
8183 }
8284}
@@ -123,6 +125,7 @@ impl AsFd for Stderr {
123125impl < ' a > AsFd for io:: StderrLock < ' a > {
124126 #[ inline]
125127 fn as_fd ( & self ) -> BorrowedFd < ' _ > {
128+ // SAFETY: user code should not close stderr out from under the standard library
126129 unsafe { BorrowedFd :: borrow_raw ( 2 ) }
127130 }
128131}
You can’t perform that action at this time.
0 commit comments