Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bf135de
Clean up rustdoc startup.
nnethercote Oct 7, 2022
c461f3a
Merge `main_options` into `main_args`.
nnethercote Oct 7, 2022
d156a90
Inline and remove `scoped_thread`.
nnethercote Oct 7, 2022
226387a
Reduce visibility of some functions.
nnethercote Oct 7, 2022
c00937f
Inline and remove `create_compiler_and_run`.
nnethercote Oct 7, 2022
8067016
Apply `Lrc` later to `sess` and `codegen_backend`.
nnethercote Oct 7, 2022
1f0463a
Replace a `spawn_unchecked` with `spawn_scoped`.
nnethercote Oct 7, 2022
ee97f7f
Allow LTO for dylibs
bjorn3 Sep 4, 2022
88bb4e4
impl AsFd for io::{Stdin, Stdout, Stderr}, not the sys versions
joshtriplett Oct 9, 2022
ef68327
Consolidate AsFd instances for stdio types into `library/std/src/os/f…
joshtriplett Oct 10, 2022
202ccc5
Migrate highlight style to CSS variables
GuillaumeGomez Oct 4, 2022
bca1005
Add GUI test for source code pages highlighting
GuillaumeGomez Oct 4, 2022
5c38950
Rollup merge of #102623 - davidtwco:translation-eager, r=compiler-errors
Dylan-DPC Oct 12, 2022
f1807cc
Rollup merge of #102769 - nnethercote:rustdoc-startup, r=jyn514
Dylan-DPC Oct 12, 2022
aa538e6
Rollup merge of #102830 - compiler-errors:constness-parity, r=fee1-dead
Dylan-DPC Oct 12, 2022
a51f145
Rollup merge of #102847 - joshtriplett:bugfix-impl-fd-traits-for-io-t…
Dylan-DPC Oct 12, 2022
f7f2ae4
Rollup merge of #102883 - Urgau:fix-stabilization-half_open_range_pat…
Dylan-DPC Oct 12, 2022
678fe0f
Rollup merge of #102936 - notriddle:notriddle/nav-sum, r=Dylan-DPC
Dylan-DPC Oct 12, 2022
6f1de0b
Rollup merge of #102940 - ehuss:update-books, r=ehuss
Dylan-DPC Oct 12, 2022
2d2c9e4
std: use `sync::Mutex` for internal statics
joboet Sep 3, 2022
600ac69
sync thread_local key conditions exactly with what the macro uses
RalfJung Oct 7, 2022
594838d
smarter way to avoid 'unused' warning when building for tests
RalfJung Oct 8, 2022
dbc8f51
Move some tests to more reasonable directories
c410-f3r Oct 13, 2022
5191256
fix a typo
whentojump Oct 13, 2022
112ce80
Report duplicate definition in impls with overlap check.
cjgillot Aug 13, 2022
513f699
rustdoc: remove unused CSS `.search-container > *`
notriddle Oct 13, 2022
eab41a1
Suppress irrefutable let patterns lint for prefixes in match guards
est31 Oct 13, 2022
b841848
check if the self type is `ty::Float` before getting second substs
TaKO8Ki Oct 13, 2022
5378677
normalize stderr
TaKO8Ki Oct 13, 2022
7122aba
more dupe word typos
Rageking8 Oct 13, 2022
dbb4271
checktools: fix comments
RalfJung Oct 14, 2022
5218e24
wasm-ignore some tests that access thread-local private details
RalfJung Oct 14, 2022
b8bb406
remove leading newlines from integer primitive doc examples
Oct 14, 2022
b03bece
Rollup merge of #102847 - joshtriplett:bugfix-impl-fd-traits-for-io-t…
Dylan-DPC Oct 14, 2022
b4906ac
Rollup merge of #102856 - cjgillot:impl-single-check, r=petrochenkov
Dylan-DPC Oct 14, 2022
20e1268
Rollup merge of #102914 - GuillaumeGomez:migrate-css-highlight-withou…
Dylan-DPC Oct 14, 2022
3017341
Rollup merge of #102938 - c410-f3r:here-we-go-again, r=petrochenkov
Dylan-DPC Oct 14, 2022
8c9ecbb
Rollup merge of #103015 - whentojump:patch, r=compiler-errors
Dylan-DPC Oct 14, 2022
77064b7
Rollup merge of #103018 - Rageking8:more-dupe-word-typos, r=TaKO8Ki
Dylan-DPC Oct 14, 2022
587b9c1
Rollup merge of #103025 - notriddle:notriddle/search-container-star, …
Dylan-DPC Oct 14, 2022
7cf09c5
Rollup merge of #103031 - est31:match_guard_irrefutable_let, r=oli-obk
Dylan-DPC Oct 14, 2022
42ce39d
Rollup merge of #100579 - joboet:sync_mutex_everywhere, r=thomcc
albertlarsan68 Oct 14, 2022
3f3fcc6
Rollup merge of #101403 - bjorn3:dylib_lto, r=Mark-Simulacrum
albertlarsan68 Oct 14, 2022
43381a2
Rollup merge of #102783 - RalfJung:tls, r=thomcc
albertlarsan68 Oct 14, 2022
909d03d
Rollup merge of #102914 - GuillaumeGomez:migrate-css-highlight-withou…
albertlarsan68 Oct 14, 2022
74cbeef
Rollup merge of #102960 - Dylan-DPC:rollup-ud1dlfl, r=Dylan-DPC
albertlarsan68 Oct 14, 2022
639095b
Rollup merge of #103003 - TaKO8Ki:fix-102989, r=compiler-errors
albertlarsan68 Oct 14, 2022
ecb1bfd
Rollup merge of #103015 - whentojump:patch, r=compiler-errors
albertlarsan68 Oct 14, 2022
18d52f9
Rollup merge of #103018 - Rageking8:more-dupe-word-typos, r=TaKO8Ki
albertlarsan68 Oct 14, 2022
283bd2f
Rollup merge of #103025 - notriddle:notriddle/search-container-star, …
albertlarsan68 Oct 14, 2022
03e206e
Rollup merge of #103031 - est31:match_guard_irrefutable_let, r=oli-obk
albertlarsan68 Oct 14, 2022
362f3da
Rollup merge of #103039 - RalfJung:checktools, r=Dylan-DPC
albertlarsan68 Oct 14, 2022
c6f23ed
Rollup merge of #103045 - lukas-code:blank-lines, r=GuillaumeGomez
albertlarsan68 Oct 14, 2022
97b0ece
Rollup merge of #103048 - Dylan-DPC:rollup-47r62js, r=Dylan-DPC
albertlarsan68 Oct 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions library/std/src/os/fd/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use super::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::fmt;
use crate::fs;
use crate::io;
use crate::marker::PhantomData;
use crate::mem::forget;
#[cfg(not(any(target_arch = "wasm32", target_env = "sgx")))]
Expand Down Expand Up @@ -385,3 +386,54 @@ impl<T: AsFd> AsFd for Box<T> {
(**self).as_fd()
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl AsFd for io::Stdin {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(0) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StdinLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: user code should not close stdin out from under the standard library
unsafe { BorrowedFd::borrow_raw(0) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl AsFd for io::Stdout {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(1) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StdoutLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: user code should not close stdout out from under the standard library
unsafe { BorrowedFd::borrow_raw(1) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl AsFd for io::Stderr {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(2) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StderrLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: user code should not close stderr out from under the standard library
unsafe { BorrowedFd::borrow_raw(2) }
}
}
50 changes: 1 addition & 49 deletions library/std/src/sys/unix/stdio.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::io::{self, IoSlice, IoSliceMut};
use crate::mem::ManuallyDrop;
use crate::os::unix::io::{AsFd, BorrowedFd, FromRawFd};
use crate::os::unix::io::FromRawFd;
use crate::sys::fd::FileDesc;

pub struct Stdin(());
Expand Down Expand Up @@ -91,51 +91,3 @@ pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
pub fn panic_output() -> Option<impl io::Write> {
Some(Stderr::new())
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl AsFd for io::Stdin {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(libc::STDIN_FILENO) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StdinLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(libc::STDIN_FILENO) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl AsFd for io::Stdout {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(libc::STDOUT_FILENO) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StdoutLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(libc::STDOUT_FILENO) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl AsFd for io::Stderr {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(libc::STDERR_FILENO) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StderrLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(libc::STDERR_FILENO) }
}
}
50 changes: 1 addition & 49 deletions library/std/src/sys/wasi/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::fd::WasiFd;
use crate::io::{self, IoSlice, IoSliceMut};
use crate::mem::ManuallyDrop;
use crate::os::raw;
use crate::os::wasi::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd};
use crate::os::wasi::io::{AsRawFd, FromRawFd};

pub struct Stdin;
pub struct Stdout;
Expand All @@ -23,22 +23,6 @@ impl AsRawFd for Stdin {
}
}

impl AsFd for Stdin {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(0) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StdinLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: user code should not close stdin out from under the standard library
unsafe { BorrowedFd::borrow_raw(0) }
}
}

impl io::Read for Stdin {
fn read(&mut self, data: &mut [u8]) -> io::Result<usize> {
self.read_vectored(&mut [IoSliceMut::new(data)])
Expand Down Expand Up @@ -67,22 +51,6 @@ impl AsRawFd for Stdout {
}
}

impl AsFd for Stdout {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(1) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StdoutLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: user code should not close stdout out from under the standard library
unsafe { BorrowedFd::borrow_raw(1) }
}
}

impl io::Write for Stdout {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
self.write_vectored(&[IoSlice::new(data)])
Expand Down Expand Up @@ -114,22 +82,6 @@ impl AsRawFd for Stderr {
}
}

impl AsFd for Stderr {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(2) }
}
}

#[stable(feature = "io_safety", since = "1.63.0")]
impl<'a> AsFd for io::StderrLock<'a> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: user code should not close stderr out from under the standard library
unsafe { BorrowedFd::borrow_raw(2) }
}
}

impl io::Write for Stderr {
fn write(&mut self, data: &[u8]) -> io::Result<usize> {
self.write_vectored(&[IoSlice::new(data)])
Expand Down