Skip to content

Commit 03986d2

Browse files
committed
---
yaml --- r: 212230 b: refs/heads/tmp c: 19a3971 h: refs/heads/master v: v3
1 parent 723d2db commit 03986d2

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
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 62e70d35be3fe532c26a400b499c58a18f18dd3a
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: eb6a70cbabbc74699e2b0331fef91be1fadad1bd
35+
refs/heads/tmp: 19a39710c494d9300ffdc4e3f40dfda0ef62f7ba
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: b77d60adb019bb5de05e884a99f3290ec4694137
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/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/tmp/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)