Skip to content

Commit 5691425

Browse files
committed
---
yaml --- r: 215020 b: refs/heads/beta c: 19a3971 h: refs/heads/master v: v3
1 parent ad420cb commit 5691425

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: eb6a70cbabbc74699e2b0331fef91be1fadad1bd
26+
refs/heads/beta: 19a39710c494d9300ffdc4e3f40dfda0ef62f7ba
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 8c0aa6d64ebab528f7eb182812007155d6044972
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/liballoc/arc.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,15 @@ impl<T: ?Sized> Deref for Arc<T> {
332332
}
333333
}
334334

335+
#[stable(feature = "rc_arc_as_ref", since = "1.2.0")]
336+
impl<T: ?Sized> AsRef<T> for Arc<T> {
337+
338+
#[inline]
339+
fn as_ref(&self) -> &T {
340+
&self.inner().data
341+
}
342+
}
343+
335344
impl<T: Clone> Arc<T> {
336345
/// Make a mutable reference from the given `Arc<T>`.
337346
///

branches/beta/src/liballoc/rc.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ use std::boxed;
156156
use core::cell::Cell;
157157
use core::clone::Clone;
158158
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
159+
use core::convert::AsRef;
159160
use core::default::Default;
160161
use core::fmt;
161162
use core::hash::{Hasher, Hash};
@@ -379,6 +380,15 @@ impl<T: ?Sized> Deref for Rc<T> {
379380
}
380381
}
381382

383+
#[stable(feature = "rc_arc_as_ref", since = "1.2.0")]
384+
impl<T: ?Sized> AsRef<T> for Rc<T> {
385+
386+
#[inline(always)]
387+
fn as_ref(&self) -> &T {
388+
&self.inner().value
389+
}
390+
}
391+
382392
#[stable(feature = "rust1", since = "1.0.0")]
383393
impl<T: ?Sized> Drop for Rc<T> {
384394
/// Drops the `Rc<T>`.

0 commit comments

Comments
 (0)