Skip to content

Make io::BorrowedCursor::advance safe #120741

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 17, 2024
Merged

Conversation

a1phyr
Copy link
Contributor

@a1phyr a1phyr commented Feb 7, 2024

This also keeps the old advance method under advance_unchecked name.

This makes pattern like std::io::default_read_buf safe to write.

@rustbot
Copy link
Collaborator

rustbot commented Feb 7, 2024

r? @joshtriplett

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

@rustbot rustbot added O-unix Operating system: Unix-like 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 Feb 7, 2024
@rust-log-analyzer

This comment has been minimized.

This also keeps the old `advance` method under `advance_unchecked` name.

This makes pattern like `std::io::default_read_buf` safe to write.
@a1phyr a1phyr force-pushed the safe_buffer_advance branch from 57b634f to 0a42a54 Compare February 7, 2024 15:46
@rustbot rustbot added O-hermit Operating System: Hermit O-solid Operating System: SOLID O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows labels Feb 7, 2024
@joshtriplett
Copy link
Member

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 11, 2024
@rustbot rustbot assigned m-ou-se and unassigned joshtriplett Feb 11, 2024
@m-ou-se
Copy link
Member

m-ou-se commented Feb 15, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 15, 2024

📌 Commit 0a42a54 has been approved by m-ou-se

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 Feb 15, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 15, 2024
Make `io::BorrowedCursor::advance` safe

This also keeps the old `advance` method under `advance_unchecked` name.

This makes pattern like `std::io::default_read_buf` safe to write.
oli-obk added a commit to oli-obk/rust that referenced this pull request Feb 15, 2024
Make `io::BorrowedCursor::advance` safe

This also keeps the old `advance` method under `advance_unchecked` name.

This makes pattern like `std::io::default_read_buf` safe to write.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2024
…llaumeGomez

Rollup of 13 pull requests

Successful merges:

 - rust-lang#118264 (Optimize `VecDeque::drain` for (half-)open ranges)
 - rust-lang#120741 (Make `io::BorrowedCursor::advance` safe)
 - rust-lang#120777 (Bump Unicode to version 15.1.0, regenerate tables)
 - rust-lang#120971 (Fix comment in core/src/str/validations.rs)
 - rust-lang#121034 (Improve wording of `static_mut_ref`)
 - rust-lang#121095 (Add extra indent spaces for rust-playground link)
 - rust-lang#121109 (Add an ErrorGuaranteed to ast::TyKind::Err (attempt 2))
 - rust-lang#121119 (Make `async Fn` trait kind errors better)
 - rust-lang#121141 (Fix closure kind docs)
 - rust-lang#121145 (Update aarch64 target feature docs to match LLVM)
 - rust-lang#121146 (Only point out non-diverging arms for match suggestions)
 - rust-lang#121147 (Avoid debug logging entire MIR body)
 - rust-lang#121155 (doc: add note about panicking examples for strict_overflow_ops)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Feb 17, 2024

⌛ Testing commit 0a42a54 with merge 405b22f...

@bors
Copy link
Collaborator

bors commented Feb 17, 2024

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 405b22f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 17, 2024
@bors bors merged commit 405b22f into rust-lang:master Feb 17, 2024
@rustbot rustbot added this to the 1.78.0 milestone Feb 17, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (405b22f): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
5.5% [5.5%, 5.5%] 1
Regressions ❌
(secondary)
1.3% [1.2%, 1.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 5.5% [5.5%, 5.5%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.6% [3.6%, 3.6%] 1
Regressions ❌
(secondary)
9.4% [9.4%, 9.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.6% [3.6%, 3.6%] 1

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.0%, 0.1%] 5

Bootstrap: 639.086s -> 638.214s (-0.14%)
Artifact size: 308.39 MiB -> 306.34 MiB (-0.66%)

@a1phyr a1phyr deleted the safe_buffer_advance branch March 12, 2024 17:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. O-hermit Operating System: Hermit O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows 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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants