Skip to content

Commit

Permalink
Unrolled build for rust-lang#130800
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#130800 - bjoernager:const-mut-cursor, r=joshtriplett

Mark `get_mut` and `set_position` in `std::io::Cursor` as const.

Relevant tracking issue: rust-lang#130801

The methods `get_mut` and `set_position` can trivially be marked as const due to rust-lang#57349 being stabilised.
  • Loading branch information
rust-timer authored Nov 21, 2024
2 parents 3fee0f1 + 26c4893 commit d357eca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/std/src/io/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ impl<T> Cursor<T> {
/// let reference = buff.get_mut();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn get_mut(&mut self) -> &mut T {
#[rustc_const_unstable(feature = "const_mut_cursor", issue = "130801")]
pub const fn get_mut(&mut self) -> &mut T {
&mut self.inner
}

Expand Down Expand Up @@ -200,7 +201,8 @@ impl<T> Cursor<T> {
/// assert_eq!(buff.position(), 4);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn set_position(&mut self, pos: u64) {
#[rustc_const_unstable(feature = "const_mut_cursor", issue = "130801")]
pub const fn set_position(&mut self, pos: u64) {
self.pos = pos;
}
}
Expand Down

0 comments on commit d357eca

Please sign in to comment.