Skip to content

Commit d1a1d33

Browse files
committed
Rollup merge of rust-lang#21951 - Gankro:entry, r=aturon
This also removes two erroneous re-exports of the Entry variants, and so is incidentally a [breaking-change], though presumably no one should have been using those. r? @aturon
2 parents 08a2bef + 5cbbc12 commit d1a1d33

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

src/libcollections/btree/map.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// writing (August 2014) freely licensed under the following Creative Commons Attribution
1616
// License: [CC BY 2.5 CA](http://creativecommons.org/licenses/by/2.5/ca/).
1717

18-
pub use self::Entry::*;
18+
use self::Entry::*;
1919

2020
use core::prelude::*;
2121

@@ -1137,47 +1137,41 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
11371137
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
11381138
/// Sets the value of the entry with the VacantEntry's key,
11391139
/// and returns a mutable reference to it.
1140-
#[unstable(feature = "collections",
1141-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
1140+
#[stable(feature = "rust1", since = "1.0.0")]
11421141
pub fn insert(self, value: V) -> &'a mut V {
11431142
self.stack.insert(self.key, value)
11441143
}
11451144
}
11461145

11471146
impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
11481147
/// Gets a reference to the value in the entry.
1149-
#[unstable(feature = "collections",
1150-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
1148+
#[stable(feature = "rust1", since = "1.0.0")]
11511149
pub fn get(&self) -> &V {
11521150
self.stack.peek()
11531151
}
11541152

11551153
/// Gets a mutable reference to the value in the entry.
1156-
#[unstable(feature = "collections",
1157-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
1154+
#[stable(feature = "rust1", since = "1.0.0")]
11581155
pub fn get_mut(&mut self) -> &mut V {
11591156
self.stack.peek_mut()
11601157
}
11611158

11621159
/// Converts the entry into a mutable reference to its value.
1163-
#[unstable(feature = "collections",
1164-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
1160+
#[stable(feature = "rust1", since = "1.0.0")]
11651161
pub fn into_mut(self) -> &'a mut V {
11661162
self.stack.into_top()
11671163
}
11681164

11691165
/// Sets the value of the entry with the OccupiedEntry's key,
11701166
/// and returns the entry's old value.
1171-
#[unstable(feature = "collections",
1172-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
1167+
#[stable(feature = "rust1", since = "1.0.0")]
11731168
pub fn insert(&mut self, mut value: V) -> V {
11741169
mem::swap(self.stack.peek_mut(), &mut value);
11751170
value
11761171
}
11771172

11781173
/// Takes the value of the entry out of the map, and returns it.
1179-
#[unstable(feature = "collections",
1180-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
1174+
#[stable(feature = "rust1", since = "1.0.0")]
11811175
pub fn remove(self) -> V {
11821176
self.stack.remove()
11831177
}
@@ -1563,10 +1557,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
15631557
///
15641558
/// assert_eq!(count["a"], 3u);
15651559
/// ```
1566-
/// The key must have the same ordering before or after `.to_owned()` is called.
1567-
#[unstable(feature = "collections",
1568-
reason = "precise API still under development")]
1569-
pub fn entry<'a>(&'a mut self, mut key: K) -> Entry<'a, K, V> {
1560+
#[stable(feature = "rust1", since = "1.0.0")]
1561+
pub fn entry(&mut self, mut key: K) -> Entry<K, V> {
15701562
// same basic logic of `swap` and `pop`, blended together
15711563
let mut stack = stack::PartialSearchStack::new(self);
15721564
loop {

src/libcollections/vec_map.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
#![allow(missing_docs)]
1515

16-
pub use self::Entry::*;
16+
use self::Entry::*;
1717

1818
use core::prelude::*;
1919

@@ -539,8 +539,7 @@ impl<V> VecMap<V> {
539539
///
540540
/// assert_eq!(count[1], 3);
541541
/// ```
542-
#[unstable(feature = "collections",
543-
reason = "precise API still under development")]
542+
#[stable(feature = "rust1", since = "1.0.0")]
544543
pub fn entry(&mut self, key: usize) -> Entry<V> {
545544
// FIXME(Gankro): this is basically the dumbest implementation of
546545
// entry possible, because weird non-lexical borrows issues make it
@@ -576,8 +575,7 @@ impl<'a, V> Entry<'a, V> {
576575
impl<'a, V> VacantEntry<'a, V> {
577576
/// Sets the value of the entry with the VacantEntry's key,
578577
/// and returns a mutable reference to it.
579-
#[unstable(feature = "collections",
580-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
578+
#[stable(feature = "rust1", since = "1.0.0")]
581579
pub fn insert(self, value: V) -> &'a mut V {
582580
let index = self.index;
583581
self.map.insert(index, value);
@@ -587,41 +585,36 @@ impl<'a, V> VacantEntry<'a, V> {
587585

588586
impl<'a, V> OccupiedEntry<'a, V> {
589587
/// Gets a reference to the value in the entry.
590-
#[unstable(feature = "collections",
591-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
588+
#[stable(feature = "rust1", since = "1.0.0")]
592589
pub fn get(&self) -> &V {
593590
let index = self.index;
594591
&self.map[index]
595592
}
596593

597594
/// Gets a mutable reference to the value in the entry.
598-
#[unstable(feature = "collections",
599-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
595+
#[stable(feature = "rust1", since = "1.0.0")]
600596
pub fn get_mut(&mut self) -> &mut V {
601597
let index = self.index;
602598
&mut self.map[index]
603599
}
604600

605601
/// Converts the entry into a mutable reference to its value.
606-
#[unstable(feature = "collections",
607-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
602+
#[stable(feature = "rust1", since = "1.0.0")]
608603
pub fn into_mut(self) -> &'a mut V {
609604
let index = self.index;
610605
&mut self.map[index]
611606
}
612607

613608
/// Sets the value of the entry with the OccupiedEntry's key,
614609
/// and returns the entry's old value.
615-
#[unstable(feature = "collections",
616-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
610+
#[stable(feature = "rust1", since = "1.0.0")]
617611
pub fn insert(&mut self, value: V) -> V {
618612
let index = self.index;
619613
self.map.insert(index, value).unwrap()
620614
}
621615

622616
/// Takes the value of the entry out of the map, and returns it.
623-
#[unstable(feature = "collections",
624-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
617+
#[stable(feature = "rust1", since = "1.0.0")]
625618
pub fn remove(self) -> V {
626619
let index = self.index;
627620
self.map.remove(&index).unwrap()

src/libstd/collections/hash/map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,8 @@ impl<K, V, S, H> HashMap<K, V, S>
929929
}
930930

931931
/// Gets the given key's corresponding entry in the map for in-place manipulation.
932-
#[unstable(feature = "std_misc",
933-
reason = "precise API still being fleshed out")]
934-
pub fn entry<'a>(&'a mut self, key: K) -> Entry<'a, K, V>
935-
{
932+
#[stable(feature = "rust1", since = "1.0.0")]
933+
pub fn entry(&mut self, key: K) -> Entry<K, V> {
936934
// Gotta resize now.
937935
self.reserve(1);
938936

@@ -1496,43 +1494,45 @@ impl<'a, K, V> Entry<'a, K, V> {
14961494
}
14971495
}
14981496

1499-
#[unstable(feature = "std_misc",
1500-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
15011497
impl<'a, K, V> OccupiedEntry<'a, K, V> {
15021498
/// Gets a reference to the value in the entry.
1499+
#[stable(feature = "rust1", since = "1.0.0")]
15031500
pub fn get(&self) -> &V {
15041501
self.elem.read().1
15051502
}
15061503

15071504
/// Gets a mutable reference to the value in the entry.
1505+
#[stable(feature = "rust1", since = "1.0.0")]
15081506
pub fn get_mut(&mut self) -> &mut V {
15091507
self.elem.read_mut().1
15101508
}
15111509

15121510
/// Converts the OccupiedEntry into a mutable reference to the value in the entry
15131511
/// with a lifetime bound to the map itself
1512+
#[stable(feature = "rust1", since = "1.0.0")]
15141513
pub fn into_mut(self) -> &'a mut V {
15151514
self.elem.into_mut_refs().1
15161515
}
15171516

15181517
/// Sets the value of the entry, and returns the entry's old value
1518+
#[stable(feature = "rust1", since = "1.0.0")]
15191519
pub fn insert(&mut self, mut value: V) -> V {
15201520
let old_value = self.get_mut();
15211521
mem::swap(&mut value, old_value);
15221522
value
15231523
}
15241524

15251525
/// Takes the value out of the entry, and returns it
1526+
#[stable(feature = "rust1", since = "1.0.0")]
15261527
pub fn remove(self) -> V {
15271528
pop_internal(self.elem).1
15281529
}
15291530
}
15301531

1531-
#[unstable(feature = "std_misc",
1532-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
15331532
impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
15341533
/// Sets the value of the entry with the VacantEntry's key,
15351534
/// and returns a mutable reference to it
1535+
#[stable(feature = "rust1", since = "1.0.0")]
15361536
pub fn insert(self, value: V) -> &'a mut V {
15371537
match self.elem {
15381538
NeqElem(bucket, ib) => {

0 commit comments

Comments
 (0)