Skip to content

std::io::Cursor::position behavior changed in the beta #47640

Closed
@pietroalbini

Description

@pietroalbini

Seems like the behavior of std::io::Cursor::position changed, because the test suite of rmp now fails on beta and nightly while working fine on stable (crater log). One example of such an error:

#[test]
fn from_str32_read_str_len_eof() {
    let buf: &[u8] = &[0xdb, 0x00, 0x00, 0x00];
    let mut cur = Cursor::new(buf);

    read_str_len(&mut cur).err().unwrap();
    assert_eq!(4, cur.position());
}
---- func::decode::string::from_str32_read_str_len_eof stdout ----
        thread 'func::decode::string::from_str32_read_str_len_eof' panicked at 'assertion failed: `(left == right)`
  left: `4`,
 right: `1`', rmp/tests/func/decode/string.rs:120:5

My guess is this regression is related to #46485, which is the only pull request that changed the behavior for Cursor<&[u8]>.

cc @3Hren

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions