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

Add Seek::seek_relative #116750

Merged
merged 3 commits into from
Nov 18, 2023
Merged

Add Seek::seek_relative #116750

merged 3 commits into from
Nov 18, 2023

Conversation

fintelia
Copy link
Contributor

The BufReader struct has a seek_relative method because its Seek::seek implementation involved dumping the internal buffer (#31100).

Unfortunately, there isn't really a good way to take advantage of that method in generic code. This PR adds the same method to the main Seek trait with the straightforward default method, and an override for BufReader that calls its implementation.

Also discussed in this internals.rust-lang.org thread.

@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 14, 2023
@Mark-Simulacrum
Copy link
Member

New unstable APIs need an approved API change proposal - can you file one and then poke here again once/if that's approved?

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2023
library/std/src/io/mod.rs Outdated Show resolved Hide resolved
library/std/src/io/mod.rs Outdated Show resolved Hide resolved
@fintelia
Copy link
Contributor Author

I think I've addressed all the concerns that have been raised?

@the8472
Copy link
Member

the8472 commented Nov 13, 2023

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 13, 2023
@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 18, 2023

📌 Commit d9f7c9d has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2023
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this pull request Nov 18, 2023
…k-Simulacrum

Add Seek::seek_relative

The `BufReader` struct has a `seek_relative` method because its `Seek::seek` implementation involved dumping the internal buffer (rust-lang#31100).

Unfortunately, there isn't really a good way to take advantage of that method in generic code. This PR adds the same method to the main `Seek` trait with the straightforward default method, and an override for `BufReader` that calls its implementation.

_Also discussed in [this](https://internals.rust-lang.org/t/add-seek-seek-relative/19546) internals.rust-lang.org thread._
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this pull request Nov 18, 2023
…k-Simulacrum

Add Seek::seek_relative

The `BufReader` struct has a `seek_relative` method because its `Seek::seek` implementation involved dumping the internal buffer (rust-lang#31100).

Unfortunately, there isn't really a good way to take advantage of that method in generic code. This PR adds the same method to the main `Seek` trait with the straightforward default method, and an override for `BufReader` that calls its implementation.

_Also discussed in [this](https://internals.rust-lang.org/t/add-seek-seek-relative/19546) internals.rust-lang.org thread._
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 18, 2023
Rollup of 6 pull requests

Successful merges:

 - rust-lang#116446 (Yeet `mir::Const::from_anon_const`)
 - rust-lang#116750 (Add Seek::seek_relative)
 - rust-lang#117110 (Suggest field typo through derefs)
 - rust-lang#117961 (Add `x suggest` entries for testing `mir-opt` and `coverage`)
 - rust-lang#118020 (Fix links to `From<{OwnedHandle, OwnedFd}> for std::process::Child{Stdin, Stdout, Stderr}` in 1.74 release notes)
 - rust-lang#118034 (bump few deps to fix unsoundness and drop few dup deps)

r? `@ghost`
`@rustbot` modify labels: rollup
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Nov 18, 2023
…k-Simulacrum

Add Seek::seek_relative

The `BufReader` struct has a `seek_relative` method because its `Seek::seek` implementation involved dumping the internal buffer (rust-lang#31100).

Unfortunately, there isn't really a good way to take advantage of that method in generic code. This PR adds the same method to the main `Seek` trait with the straightforward default method, and an override for `BufReader` that calls its implementation.

_Also discussed in [this](https://internals.rust-lang.org/t/add-seek-seek-relative/19546) internals.rust-lang.org thread._
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 18, 2023
Rollup of 5 pull requests

Successful merges:

 - rust-lang#116750 (Add Seek::seek_relative)
 - rust-lang#117110 (Suggest field typo through derefs)
 - rust-lang#117961 (Add `x suggest` entries for testing `mir-opt` and `coverage`)
 - rust-lang#118020 (Fix links to `From<{OwnedHandle, OwnedFd}> for std::process::Child{Stdin, Stdout, Stderr}` in 1.74 release notes)
 - rust-lang#118034 (bump few deps to fix unsoundness and drop few dup deps)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit baf3059 into rust-lang:master Nov 18, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 18, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 18, 2023
Rollup merge of rust-lang#116750 - fintelia:seek_seek_relative, r=Mark-Simulacrum

Add Seek::seek_relative

The `BufReader` struct has a `seek_relative` method because its `Seek::seek` implementation involved dumping the internal buffer (rust-lang#31100).

Unfortunately, there isn't really a good way to take advantage of that method in generic code. This PR adds the same method to the main `Seek` trait with the straightforward default method, and an override for `BufReader` that calls its implementation.

_Also discussed in [this](https://internals.rust-lang.org/t/add-seek-seek-relative/19546) internals.rust-lang.org thread._
@fintelia fintelia deleted the seek_seek_relative branch March 10, 2024 23:11
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 13, 2024
Stabilize `seek_seek_relative`

This PR stabilizes `seek_seek_relative`:

```rust
// std::io::Seek

trait Seek {
    fn seek_relative(&mut self, offset: i64) -> Result<()>;
}
```

<br>

Tracking issue: rust-lang#117374.
Implementation PR: rust-lang#116750.

FCPs already completed in the tracking issue.

Closes rust-lang#117374.

r? libs-api
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 13, 2024
Stabilize `seek_seek_relative`

This PR stabilizes `seek_seek_relative`:

```rust
// std::io::Seek

trait Seek {
    fn seek_relative(&mut self, offset: i64) -> Result<()>;
}
```

<br>

Tracking issue: rust-lang#117374.
Implementation PR: rust-lang#116750.

FCPs already completed in the tracking issue.

Closes rust-lang#117374.

r? libs-api
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 13, 2024
Rollup merge of rust-lang#123817 - slanterns:seek_relative, r=dtolnay

Stabilize `seek_seek_relative`

This PR stabilizes `seek_seek_relative`:

```rust
// std::io::Seek

trait Seek {
    fn seek_relative(&mut self, offset: i64) -> Result<()>;
}
```

<br>

Tracking issue: rust-lang#117374.
Implementation PR: rust-lang#116750.

FCPs already completed in the tracking issue.

Closes rust-lang#117374.

r? libs-api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants