Skip to content

Expand upper bounds on RangeBounds impls #64327

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// .iter()
/// .map(|&s| (s, 0))
/// .collect();
/// for (_, balance) in map.range_mut("B".."Cheryl") {
/// for (_, balance) in map.range_mut::<str, _>("B".."Cheryl") {
/// *balance += 100;
/// }
/// for (name, balance) in &map {
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ impl<'a, T: ?Sized + 'a> RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>) {
}

#[stable(feature = "collections_range", since = "1.28.0")]
impl<T> RangeBounds<T> for RangeFrom<&T> {
impl<T: ?Sized> RangeBounds<T> for RangeFrom<&T> {
fn start_bound(&self) -> Bound<&T> {
Included(self.start)
}
Expand All @@ -894,7 +894,7 @@ impl<T> RangeBounds<T> for RangeFrom<&T> {
}

#[stable(feature = "collections_range", since = "1.28.0")]
impl<T> RangeBounds<T> for RangeTo<&T> {
impl<T: ?Sized> RangeBounds<T> for RangeTo<&T> {
fn start_bound(&self) -> Bound<&T> {
Unbounded
}
Expand All @@ -904,7 +904,7 @@ impl<T> RangeBounds<T> for RangeTo<&T> {
}

#[stable(feature = "collections_range", since = "1.28.0")]
impl<T> RangeBounds<T> for Range<&T> {
impl<T: ?Sized> RangeBounds<T> for Range<&T> {
fn start_bound(&self) -> Bound<&T> {
Included(self.start)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change supposed to apply to the RangeBounds<T> impls for RangeInclusive<&T> and RangeToInclusive<&T> (below) as well?

Expand Down