Skip to content

Commit 2ed716a

Browse files
authored
Rollup merge of #99736 - lopopolo:lopopolo/gh-80996-partial-stabilization-bounds-as-ref, r=dtolnay
Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref` Stabilizing `Bound::as_ref` will simplify the implementation for `RangeBounds<usize>` for custom range types: ```rust impl RangeBounds<usize> for Region { fn start_bound(&self) -> Bound<&usize> { // TODO: Use `self.start.as_ref()` when upstream `std` stabilizes: // #80996 match self.start { Bound::Included(ref bound) => Bound::Included(bound), Bound::Excluded(ref bound) => Bound::Excluded(bound), Bound::Unbounded => Bound::Unbounded, } } fn end_bound(&self) -> Bound<&usize> { // TODO: Use `self.end.as_ref()` when upstream `std` stabilizes: // #80996 match self.end { Bound::Included(ref bound) => Bound::Included(bound), Bound::Excluded(ref bound) => Bound::Excluded(bound), Bound::Unbounded => Bound::Unbounded, } } } ``` See: - #80996 - #80996 (comment) cc `@yaahc` who suggested partial stabilization.
2 parents 0209485 + 773df67 commit 2ed716a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/ops/range.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ pub enum Bound<T> {
677677
impl<T> Bound<T> {
678678
/// Converts from `&Bound<T>` to `Bound<&T>`.
679679
#[inline]
680-
#[unstable(feature = "bound_as_ref", issue = "80996")]
680+
#[stable(feature = "bound_as_ref_shared", since = "CURRENT_RUSTC_VERSION")]
681681
pub fn as_ref(&self) -> Bound<&T> {
682682
match *self {
683683
Included(ref x) => Included(x),

0 commit comments

Comments
 (0)