Skip to content

Commit a36e820

Browse files
committed
---
yaml --- r: 15445 b: refs/heads/try c: e712ad8 h: refs/heads/master i: 15443: 846f00a v: v3
1 parent 01d0a45 commit a36e820

File tree

4 files changed

+314
-303
lines changed

4 files changed

+314
-303
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 3e6943d8201215e60b74df7d3be8f48a52b3c2b7
5+
refs/heads/try: e712ad8f7342203504abae1b04545160610f3fc9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libcore/option.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ impl extensions<T:copy> for option<T> {
100100
{ map_default(self, def, f) }
101101
#[doc = "Performs an operation on the contained value or does nothing"]
102102
fn iter(f: fn(T)) { iter(self, f) }
103+
104+
#[doc = "Performs an operation on the contained value or does nothing"]
105+
fn each(f: fn(T) -> bool) {
106+
alt self {
107+
none { /* ok */ }
108+
some(e) { f(e); }
109+
}
110+
}
111+
103112
#[doc = "
104113
Gets the value out of an option
105114

branches/try/src/rustc/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,11 @@ fn fold_region(cx: ctxt, t0: t, fldop: fn(region, bool) -> region) -> t {
807807
}
808808

809809
fn substitute_type_params(cx: ctxt, substs: [ty::t], typ: t) -> t {
810+
if substs.len() == 0u { ret typ; }
810811
let tb = get(typ);
812+
if !tb.has_params { ret typ; }
811813
alt tb.struct {
812814
ty_param(idx, _) { substs[idx] }
813-
_ if !tb.has_params { typ }
814815
s { mk_t(cx, fold_sty(s) {|t| substitute_type_params(cx, substs, t)}) }
815816
}
816817
}

0 commit comments

Comments
 (0)