Skip to content
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

Rollup of 9 pull requests #61296

Merged
merged 40 commits into from
May 29, 2019
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
53e0474
Add better tests for hidden lifetimes in impl trait
matthewjasper May 17, 2019
fb52aea
tests: Centralize proc macros commonly used for testing
petrochenkov May 21, 2019
f27ec0f
Add test that impl Seek for BufReader correctly invalidates buffer be…
czipperz May 25, 2019
b1ae49c
Annotate test with #[test]
czipperz May 25, 2019
04e45c8
Print file mode of PermissionExt in octal in Examples
oberien May 26, 2019
7bba62c
Fixing mailmap for Carol
JosephTLyons May 28, 2019
2a6490c
Adding mailmap for myself
JosephTLyons May 28, 2019
b0c3385
Alphabetized lines with Atom's Sort Lines package
JosephTLyons May 28, 2019
ce76892
mention that MaybeUninit is a bit like Option
RalfJung May 28, 2019
2bf80cf
Update src/libcore/mem.rs
RalfJung May 28, 2019
6e5e0da
Changes the type `mir::Mir` into `mir::Body`
May 17, 2019
9c34473
Special-case `.llvm` in mangler to fix segfaults
davidtwco May 25, 2019
73f7e42
Relate identical parameters in array lengths
varkor May 11, 2019
5a585fe
Add a test for a function taking a const param array as an argument
varkor May 11, 2019
4ad5c62
Resolve consts in OpportunisticTypeResolver
varkor May 11, 2019
55dcc20
Add tests for uninferred consts during codegen
varkor May 11, 2019
c94ba63
Rename `OpportunisticTypeResolver` to `OpportunisticVarResolver`
varkor May 11, 2019
908d97d
Update test output
varkor May 12, 2019
d5c6cb8
Eagerly evaluate in `super_relate_consts`
varkor May 13, 2019
193b748
Remove FixedArraySize error
varkor May 13, 2019
57ff589
Add broken MIR regression tests
varkor May 20, 2019
cfa1f80
Fix test after rebase
varkor May 21, 2019
f865b7d
Update tests after pretty printing
varkor May 25, 2019
f13317c
Use Display rather than Debug printing for const mismatch
varkor May 25, 2019
8549953
Reintroduce `TypeError::FixedArraySize`
varkor May 27, 2019
56181cf
Correct pluralisation of tuple/array/associated type binding mismatch…
varkor May 27, 2019
b3a13fd
Make sure array length diagnostic doesn't regress
varkor May 27, 2019
2949160
Fix nits
varkor May 28, 2019
6233d1f
Use assert_eq! instead of println! in tests
varkor May 28, 2019
3e5beb2
rustc: rename Mir to mir::Body in comments and to MIR in error strings.
eddyb May 28, 2019
95013e6
syntax: bail out of `find_width_of_character_at_span` if the span doe…
eddyb May 28, 2019
d85e256
Rollup merge of #60742 - varkor:fn-const-array-parameter, r=eddyb
Centril May 28, 2019
e19a229
Rollup merge of #60756 - matthewjasper:extra-impl-trait-tests, r=niko…
Centril May 28, 2019
ee08261
Rollup merge of #60928 - TheSirC:fix/60229, r=eddyb
Centril May 28, 2019
bfe9080
Rollup merge of #61024 - petrochenkov:proctest, r=nikomatsakis
Centril May 28, 2019
745af72
Rollup merge of #61157 - czipperz:BufReader-Seek-remove-extra-discard…
Centril May 28, 2019
dae331d
Rollup merge of #61195 - davidtwco:seg-fault-mangler, r=eddyb
Centril May 28, 2019
21684c0
Rollup merge of #61202 - oberien:permissionext-print-octal, r=varkor
Centril May 28, 2019
2d01c91
Rollup merge of #61259 - JosephTLyons:mailmap-fixes, r=nikomatsakis
Centril May 28, 2019
9121a73
Rollup merge of #61273 - RalfJung:maybe-uninit, r=Centril
Centril May 28, 2019
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
Prev Previous commit
Next Next commit
Add test that impl Seek for BufReader correctly invalidates buffer be…
…tween seeks
czipperz committed May 25, 2019

Verified

This commit was signed with the committer’s verified signature.
commit f27ec0f05f2f90ca0291c24a58022b789792c8bf
34 changes: 34 additions & 0 deletions src/libstd/io/buffered.rs
Original file line number Diff line number Diff line change
@@ -1162,6 +1162,40 @@ mod tests {
assert_eq!(reader.get_ref().pos, expected);
}

fn test_buffered_reader_seek_underflow_discard_buffer_between_seeks() {
// gimmick reader that returns Err after first seek
struct ErrAfterFirstSeekReader {
first_seek: bool,
}
impl Read for ErrAfterFirstSeekReader {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
for x in &mut *buf {
*x = 0;
}
Ok(buf.len())
}
}
impl Seek for ErrAfterFirstSeekReader {
fn seek(&mut self, _: SeekFrom) -> io::Result<u64> {
if self.first_seek {
self.first_seek = false;
Ok(0)
} else {
Err(io::Error::new(io::ErrorKind::Other, "oh no!"))
}
}
}

let mut reader = BufReader::with_capacity(5, ErrAfterFirstSeekReader { first_seek: true });
assert_eq!(reader.fill_buf().ok(), Some(&[0, 0, 0, 0, 0][..]));

// The following seek will require two underlying seeks. The first will
// succeed but the second will fail. This should still invalidate the
// buffer.
assert!(reader.seek(SeekFrom::Current(i64::min_value())).is_err());
assert_eq!(reader.buffer().len(), 0);
}

#[test]
fn test_buffered_writer() {
let inner = Vec::new();