Skip to content

Commit 9419308

Browse files
committed
---
yaml --- r: 80723 b: refs/heads/try c: 2bd87ad h: refs/heads/master i: 80721: ce8d8a2 80719: b0a358b v: v3
1 parent fe72752 commit 9419308

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: e6c11313c88574aa2500df2f76c5534fbc2e0512
5+
refs/heads/try: 2bd87ad432901f3baeab2fc1f2aa8aa328f04ea7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libstd/vec.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ use clone::{Clone, DeepClone};
104104
use container::{Container, Mutable};
105105
use cmp::{Eq, TotalOrd, Ordering, Less, Equal, Greater};
106106
use cmp;
107+
use default::Default;
107108
use iter::*;
108109
use libc::c_void;
109110
use num::{Integer, Zero, CheckedAdd, Saturating};
@@ -2236,6 +2237,19 @@ impl<A: DeepClone> DeepClone for ~[A] {
22362237
}
22372238
}
22382239

2240+
// This works because every lifetime is a sub-lifetime of 'static
2241+
impl<'self, A> Default for &'self [A] {
2242+
fn default() -> &'self [A] { &'self [] }
2243+
}
2244+
2245+
impl<A> Default for ~[A] {
2246+
fn default() -> ~[A] { ~[] }
2247+
}
2248+
2249+
impl<A> Default for @[A] {
2250+
fn default() -> @[A] { @[] }
2251+
}
2252+
22392253
// This works because every lifetime is a sub-lifetime of 'static
22402254
impl<'self, A> Zero for &'self [A] {
22412255
fn zero() -> &'self [A] { &'self [] }

0 commit comments

Comments
 (0)