Skip to content

Commit 2e6419e

Browse files
committed
---
yaml --- r: 277630 b: refs/heads/try c: 9370d3a h: refs/heads/master
1 parent 70d1636 commit 2e6419e

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 77987ba89894997c174ac8b01185c0dc12913fa5
4+
refs/heads/try: 9370d3a05107bdcac6fb62d3bd5380e1d7c79b5b
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/libcore/cell.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ impl<T:Copy> Cell<T> {
232232
pub fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
233233
&self.value
234234
}
235+
236+
/// Returns a mutable reference to the underlying data.
237+
///
238+
/// This call borrows `Cell` mutably (at compile-time) which guarantees
239+
/// that we possess the only reference.
240+
#[inline]
241+
#[unstable(feature = "cell_get_mut", issue = "33444")]
242+
pub fn get_mut(&mut self) -> &mut T {
243+
unsafe {
244+
&mut *self.value.get()
245+
}
246+
}
235247
}
236248

237249
#[stable(feature = "rust1", since = "1.0.0")]
@@ -455,6 +467,18 @@ impl<T: ?Sized> RefCell<T> {
455467
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
456468
&self.value
457469
}
470+
471+
/// Returns a mutable reference to the underlying data.
472+
///
473+
/// This call borrows `RefCell` mutably (at compile-time) so there is no
474+
/// need for dynamic checks.
475+
#[inline]
476+
#[unstable(feature = "cell_get_mut", issue="33444")]
477+
pub fn get_mut(&mut self) -> &mut T {
478+
unsafe {
479+
&mut *self.value.get()
480+
}
481+
}
458482
}
459483

460484
#[stable(feature = "rust1", since = "1.0.0")]

branches/try/src/libstd/ffi/c_str.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -326,22 +326,6 @@ impl fmt::Debug for CStr {
326326
}
327327
}
328328

329-
#[stable(feature = "cstr_default", since = "1.10.0")]
330-
impl<'a> Default for &'a CStr {
331-
fn default() -> &'a CStr {
332-
static SLICE: &'static [c_char] = &[0];
333-
unsafe { CStr::from_ptr(SLICE.as_ptr()) }
334-
}
335-
}
336-
337-
#[stable(feature = "cstr_default", since = "1.10.0")]
338-
impl Default for CString {
339-
fn default() -> CString {
340-
let a: &CStr = Default::default();
341-
a.to_owned()
342-
}
343-
}
344-
345329
#[stable(feature = "cstr_borrow", since = "1.3.0")]
346330
impl Borrow<CStr> for CString {
347331
fn borrow(&self) -> &CStr { self }

0 commit comments

Comments
 (0)