Skip to content

Rollup of 7 pull requests #73821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 34 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
358dc1d
Added io forwarding methods to the stdio structs
Lucretiel May 28, 2020
93cbad6
Add documentation to point to `!is_dir` instead of `is_file`
poliorcetics Jun 11, 2020
ec63f9d
Added the note to Metadata too
poliorcetics Jun 11, 2020
c1243db
Make a note about is_dir vs is_file in Path too
poliorcetics Jun 11, 2020
b60cefe
Removed write_fmt forwarding, to fix recursive borrow issues
Lucretiel Jun 17, 2020
14d385b
Restore some write_fmts
Lucretiel Jun 17, 2020
49f6166
Prepare for LLVM 11
cuviper Jun 26, 2020
3678e5c
errors: use `-Z terminal-width` in JSON emitter
davidtwco Jun 26, 2020
89e2c1d
Mark feature gate as accepted
ecstatic-morse May 21, 2020
0438e25
Remove `control_flow_destroyed` and properly lower `&&` and `||`
ecstatic-morse May 21, 2020
8660621
Remove `const_if_match` feature gate from libraries
ecstatic-morse May 21, 2020
23a907e
MIR const-checking
ecstatic-morse May 21, 2020
ff0096d
HIR const-checking
ecstatic-morse May 21, 2020
edd4b36
Update tests
ecstatic-morse May 21, 2020
23d93c3
Remove `const_if_match` from unstable book
ecstatic-morse May 21, 2020
088d036
Require `allow_internal_unstable` in HIR const-checker
ecstatic-morse May 21, 2020
e0d6ad2
Mark `const_loop` feature gate as accepted
ecstatic-morse Jun 26, 2020
839f9c0
Remove uses of `const_loop` in `rustc`
ecstatic-morse Jun 26, 2020
984e536
Stop checking for `while` and `loop` in a const context
ecstatic-morse Jun 26, 2020
8fe1b1d
Update tests
ecstatic-morse Jun 26, 2020
63078c3
Remove `ignore-tidy-filelength`
ecstatic-morse Jun 26, 2020
a4e7b47
use LocalDefId in module checking
lcnr Jun 27, 2020
1875c79
more LocalDefId in ty::context
lcnr Jun 27, 2020
2d280a5
more LocalDefId cleanup
lcnr Jun 27, 2020
9308860
fix typo in self-profile.md
atetubou Jun 27, 2020
d25d6c5
Update the documentation to point to open instead of is_file and is_dir
poliorcetics Jun 27, 2020
8e8c54a
Added the parapgrah to path::Path::is_file too
poliorcetics Jun 27, 2020
6fc1714
Rollup merge of #72437 - ecstatic-morse:stabilize-const-if-match, r=o…
Dylan-DPC Jun 27, 2020
e5343ec
Rollup merge of #72705 - Lucretiel:stdio-forwarding, r=Amanieu
Dylan-DPC Jun 27, 2020
d31b8ba
Rollup merge of #73243 - poliorcetics:discourage-is-file, r=Amanieu
Dylan-DPC Jun 27, 2020
4b307b2
Rollup merge of #73525 - cuviper:llvm11, r=nikic
Dylan-DPC Jun 27, 2020
23c8bc4
Rollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=est…
Dylan-DPC Jun 27, 2020
01ed6ef
Rollup merge of #73796 - lcnr:LocalDefId, r=matthewjasper
Dylan-DPC Jun 27, 2020
c6c0515
Rollup merge of #73797 - atetubou:patch-1, r=jonas-schievink
Dylan-DPC Jun 27, 2020
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
Next Next commit
Added io forwarding methods to the stdio structs
  • Loading branch information
Lucretiel committed May 28, 2020
commit 358dc1d8c2e10eceaf3c04d532bbde73b0dd4bb7
83 changes: 83 additions & 0 deletions src/libstd/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,20 @@ impl Read for StdinRaw {
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
}

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
self.0.read_to_end(buf)
}

fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
self.0.read_to_string(buf)
}

fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
self.0.read_exact(buf)
}
}

impl Write for StdoutRaw {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
Expand All @@ -114,7 +127,20 @@ impl Write for StdoutRaw {
fn flush(&mut self) -> io::Result<()> {
self.0.flush()
}

fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.0.write_all(buf)
}

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.0.write_all_vectored(bufs)
}

fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
self.0.write_fmt(fmt)
}
}

impl Write for StderrRaw {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
Expand All @@ -132,6 +158,18 @@ impl Write for StderrRaw {
fn flush(&mut self) -> io::Result<()> {
self.0.flush()
}

fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.0.write_all(buf)
}

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.0.write_all_vectored(bufs)
}

fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
self.0.write_fmt(fmt)
}
}

enum Maybe<T> {
Expand Down Expand Up @@ -420,16 +458,37 @@ impl Read for StdinLock<'_> {
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
}

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
self.inner.read_to_end(buf)
}

fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
self.inner.read_to_string(buf)
}

fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
self.inner.read_exact(buf)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl BufRead for StdinLock<'_> {
fn fill_buf(&mut self) -> io::Result<&[u8]> {
self.inner.fill_buf()
}

fn consume(&mut self, n: usize) {
self.inner.consume(n)
}

fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
self.inner.read_until(byte, buf)
}

fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
self.inner.read_line(buf)
}
}

#[stable(feature = "std_debug", since = "1.16.0")]
Expand Down Expand Up @@ -596,6 +655,9 @@ impl Write for Stdout {
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> io::Result<()> {
self.lock().write_fmt(args)
}
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.lock().write_all_vectored(bufs)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for StdoutLock<'_> {
Expand All @@ -612,6 +674,15 @@ impl Write for StdoutLock<'_> {
fn flush(&mut self) -> io::Result<()> {
self.inner.borrow_mut().flush()
}
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.inner.borrow_mut().write_all(buf)
}
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.inner.borrow_mut().write_all_vectored(bufs)
}
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
self.inner.borrow_mut().write_fmt(fmt)
}
}

#[stable(feature = "std_debug", since = "1.16.0")]
Expand Down Expand Up @@ -770,6 +841,9 @@ impl Write for Stderr {
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> io::Result<()> {
self.lock().write_fmt(args)
}
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.lock().write_all_vectored(bufs)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for StderrLock<'_> {
Expand All @@ -786,6 +860,15 @@ impl Write for StderrLock<'_> {
fn flush(&mut self) -> io::Result<()> {
self.inner.borrow_mut().flush()
}
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.inner.borrow_mut().write_all(buf)
}
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
self.inner.borrow_mut().write_all_vectored(bufs)
}
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
self.inner.borrow_mut().write_fmt(fmt)
}
}

#[stable(feature = "std_debug", since = "1.16.0")]
Expand Down