Skip to content

Commit b58396d

Browse files
authored
try and fix build (#11)
Account for the behavior change in (based on a bisect) rust-lang/rust#125404.
1 parent 3bd7ccd commit b58396d

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,13 @@ jobs:
5757
- uses: actions/checkout@v3
5858
- uses: dtolnay/rust-toolchain@master
5959
with:
60-
toolchain: ${{ matrix.rust-version.version }}
60+
toolchain: ${{ matrix.rust-version }}
6161
components: rustfmt, clippy
6262
- uses: taiki-e/install-action@cargo-hack
6363
- uses: Swatinem/rust-cache@v2
6464
- name: Build
6565
run: |
66-
cargo hack build --feature-powerset \
67-
--exclude-features "${{ matrix.rust-version.build-features-excluded }}"
66+
cargo hack build --feature-powerset
6867
- name: Test
6968
# Dev dependencies have an MSRV > 1.70.
7069
if: ${{ matrix.rust-version.version == 'stable' }}

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ keywords = ["buffers", "zero-copy", "io"]
88
license = "Apache-2.0"
99
readme = "README.md"
1010
repository = "https://github.com/sunshowers-code/buf-list"
11-
rust-version = "1.39"
11+
rust-version = "1.70"
1212

1313
[lints]
1414
rust.unexpected_cfgs = { level = "warn", check-cfg = ["cfg(doc_cfg)"] }

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ fn into_try_stream<E>(buf_list: BufList) -> impl TryStream<Ok = Bytes, Error = E
9999

100100
## Minimum supported Rust version
101101

102-
The minimum supported Rust version (MSRV) is **1.39**, same as the `bytes` crate. Optional
103-
features may cause a bump in the MSRV.
102+
The minimum supported Rust version (MSRV) is **1.70**. Optional features may
103+
cause a bump in the MSRV.
104104

105105
The MSRV is not expected to change in the future. If the MSRV changes, it will be accompanied by
106106
a major version bump to `buf-list`.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cc bf8cfd35fe51927d4570039a090a23c4f78c40cf88e8e6ac80f6fe66f02e1a4b

src/cursor/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,15 @@ impl CursorData {
310310

311311
fn read_exact_impl(&mut self, list: &BufList, buf: &mut [u8]) -> io::Result<()> {
312312
// This is the same as read_impl as long as there's enough space.
313-
let remaining = self.num_bytes(list).saturating_sub(self.pos);
313+
let total = self.num_bytes(list);
314+
let remaining = total.saturating_sub(self.pos);
314315
let buf_len = buf.len();
315316
if remaining < buf_len as u64 {
317+
// Rust 1.80 and above will cause the position to be set to the end
318+
// of the buffer, due to (apparently)
319+
// https://github.com/rust-lang/rust/pull/125404. Follow that
320+
// behavior.
321+
self.set_pos(list, total);
316322
return Err(io::Error::new(
317323
io::ErrorKind::UnexpectedEof,
318324
ReadExactError { remaining, buf_len },

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
//!
110110
//! # Minimum supported Rust version
111111
//!
112-
//! The minimum supported Rust version (MSRV) is **1.39**, same as the `bytes` crate. Optional
113-
//! features may cause a bump in the MSRV.
112+
//! The minimum supported Rust version (MSRV) is **1.70**. Optional features may
113+
//! cause a bump in the MSRV.
114114
//!
115115
//! The MSRV is not expected to change in the future. If the MSRV changes, it will be accompanied by
116116
//! a major version bump to `buf-list`.

0 commit comments

Comments
 (0)