Skip to content

Commit c123186

Browse files
committed
---
yaml --- r: 145391 b: refs/heads/try2 c: 90d3da9 h: refs/heads/master i: 145389: 51f3872 145387: 5df32c2 145383: e0c2f3b 145375: 6b59e8f v: v3
1 parent f547214 commit c123186

File tree

103 files changed

+197
-944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+197
-944
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a170183ba39c32b9f85c50a379dc4f9b8bd6e0fa
8+
refs/heads/try2: 90d3da971148a471c5766b544dc4ba50a15e5b96
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,34 +1469,6 @@ cannot be stored in data structures or returned from
14691469
functions. Despite these limitations, stack closures are used
14701470
pervasively in Rust code.
14711471

1472-
## Managed closures
1473-
1474-
When you need to store a closure in a data structure, a stack closure
1475-
will not do, since the compiler will refuse to let you store it. For
1476-
this purpose, Rust provides a type of closure that has an arbitrary
1477-
lifetime, written `@fn` (boxed closure, analogous to the `@` pointer
1478-
type described earlier). This type of closure *is* first-class.
1479-
1480-
A managed closure does not directly access its environment, but merely
1481-
copies out the values that it closes over into a private data
1482-
structure. This means that it can not assign to these variables, and
1483-
cannot observe updates to them.
1484-
1485-
This code creates a closure that adds a given string to its argument,
1486-
returns it from a function, and then calls it:
1487-
1488-
~~~~
1489-
fn mk_appender(suffix: ~str) -> @fn(~str) -> ~str {
1490-
// The compiler knows that we intend this closure to be of type @fn
1491-
return |s| s + suffix;
1492-
}
1493-
1494-
fn main() {
1495-
let shout = mk_appender(~"!");
1496-
println(shout(~"hey ho, let's go"));
1497-
}
1498-
~~~~
1499-
15001472
## Owned closures
15011473

15021474
Owned closures, written `~fn` in analogy to the `~` pointer type,

branches/try2/src/libextra/c_vec.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ mod tests {
162162
}
163163

164164
impl Runnable for LibcFree {
165+
#[fixed_stack_segment]
165166
fn run(~self) {
166-
libc::free(self.mem)
167+
unsafe {
168+
libc::free(self.mem)
169+
}
167170
}
168171
}
169172

branches/try2/src/librustc/driver/driver.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,12 @@ mod test {
10651065
Err(f) => fail!("test_switch_implies_cfg_test: %s", f.to_err_msg())
10661066
};
10671067
let sessopts = build_session_options(
1068-
@"rustc", matches, diagnostic::emit);
1069-
let sess = build_session(sessopts, diagnostic::emit);
1068+
@"rustc",
1069+
matches,
1070+
@diagnostic::DefaultEmitter as @diagnostic::Emitter);
1071+
let sess = build_session(sessopts,
1072+
@diagnostic::DefaultEmitter as
1073+
@diagnostic::Emitter);
10701074
let cfg = build_configuration(sess);
10711075
assert!((attr::contains_name(cfg, "test")));
10721076
}
@@ -1083,8 +1087,12 @@ mod test {
10831087
}
10841088
};
10851089
let sessopts = build_session_options(
1086-
@"rustc", matches, diagnostic::emit);
1087-
let sess = build_session(sessopts, diagnostic::emit);
1090+
@"rustc",
1091+
matches,
1092+
@diagnostic::DefaultEmitter as @diagnostic::Emitter);
1093+
let sess = build_session(sessopts,
1094+
@diagnostic::DefaultEmitter as
1095+
@diagnostic::Emitter);
10881096
let cfg = build_configuration(sess);
10891097
let mut test_items = cfg.iter().filter(|m| "test" == m.name());
10901098
assert!(test_items.next().is_some());

branches/try2/src/libstd/unstable/finally.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,3 @@ fn test_owned() {
118118
spawn_with_finalizer(owned);
119119
}
120120

121-
#[test]
122-
fn test_managed() {
123-
let i = @mut 10;
124-
let managed: @fn() -> int = || {
125-
let r = *i;
126-
*i += 10;
127-
r
128-
};
129-
assert_eq!(do managed.finally {}, 10);
130-
assert_eq!(*i, 20);
131-
}

branches/try2/src/libsyntax/ext/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ pub fn syntax_expander_table() -> SyntaxEnv {
217217
}));
218218
syntax_expanders.insert(intern(&"macro_rules"),
219219
@SE(IdentTT(@SyntaxExpanderTTItem {
220-
expander: SyntaxExpanderTTItemExpanderWithContext(ext::tt::macro_rules::add_new_extension),
220+
expander: SyntaxExpanderTTItemExpanderWithContext(
221+
ext::tt::macro_rules::add_new_extension),
221222
span: None,
222223
} as @SyntaxExpanderTTItemTrait,
223224
None)));

branches/try2/src/libsyntax/ext/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ impl ast_fold for IdentRenamer {
772772

773773
// given a mutable list of renames, return a tree-folder that applies those
774774
// renames.
775-
fn renames_to_fold(renames: @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold {
775+
pub fn renames_to_fold(renames: @mut ~[(ast::Ident,ast::Name)]) -> @ast_fold {
776776
@IdentRenamer {
777777
renames: renames,
778778
} as @ast_fold
@@ -1524,7 +1524,7 @@ mod test {
15241524
let ident_str = @"x";
15251525
let tts = string_to_tts(ident_str);
15261526
let fm = fresh_mark();
1527-
let marked_once = fold::fold_tts(tts,new_mark_folder(fm) as @fold::ast_fold);
1527+
let marked_once = fold::fold_tts(tts,new_mark_folder(fm));
15281528
assert_eq!(marked_once.len(),1);
15291529
let marked_once_ctxt =
15301530
match marked_once[0] {

branches/try2/src/libsyntax/fold.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ mod test {
869869
use parse::token;
870870
use print::pprust;
871871
use super::*;
872-
872+
873873
// this version doesn't care about getting comments or docstrings in.
874874
fn fake_print_crate(s: @pprust::ps, crate: &ast::Crate) {
875875
pprust::print_mod(s, &crate.module, crate.attrs);
@@ -879,7 +879,7 @@ mod test {
879879
struct ToZzIdentFolder;
880880

881881
impl ast_fold for ToZzIdentFolder {
882-
fn fold_ident(&self, _: ident) -> ident {
882+
fn fold_ident(&self, _: ast::Ident) -> ast::Ident {
883883
token::str_to_ident("zz")
884884
}
885885
}
@@ -921,16 +921,5 @@ mod test {
921921
token::get_ident_interner()),
922922
~"zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)))");
923923
}
924-
925-
// and in cast expressions... this appears to be an existing bug.
926-
#[test] fn ident_transformation_in_types () {
927-
let zz_fold = ToZzIdentFolder;
928-
let ast = string_to_crate(@"fn a() {let z = 13 as int;}");
929-
assert_pred!(matches_codepattern,
930-
"matches_codepattern",
931-
pprust::to_str(&zz_fold.fold_crate(ast),fake_print_crate,
932-
token::get_ident_interner()),
933-
~"fn zz(){let zz=13 as zz;}");
934-
}
935924
}
936925

branches/try2/src/test/auxiliary/cci_nested_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct Entry<A,B> {
1414
}
1515

1616
pub struct alist<A,B> {
17-
eq_fn: @fn(A,A) -> bool,
17+
eq_fn: extern "Rust" fn(A,A) -> bool,
1818
data: @mut ~[Entry<A,B>]
1919
}
2020

branches/try2/src/test/auxiliary/issue4516_ty_param_lib.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

branches/try2/src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type nillist = List<()>;
4646
struct State {
4747
box: @nillist,
4848
unique: ~nillist,
49-
fn_box: @fn() -> @nillist,
5049
tuple: (@nillist, ~nillist),
5150
vec: ~[@nillist],
5251
res: r
@@ -79,19 +78,15 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
7978
State {
8079
box: @Nil,
8180
unique: ~Nil,
82-
fn_box: || @Nil::<()>,
8381
tuple: (@Nil, ~Nil),
8482
vec: ~[@Nil],
8583
res: r(@Nil)
8684
}
8785
}
8886
Some(st) => {
89-
let fn_box = st.fn_box;
90-
9187
State {
9288
box: @Cons((), st.box),
9389
unique: ~Cons((), @*st.unique),
94-
fn_box: || @Cons((), fn_box()),
9590
tuple: (@Cons((), st.tuple.first()),
9691
~Cons((), @*st.tuple.second())),
9792
vec: st.vec + &[@Cons((), *st.vec.last())],

branches/try2/src/test/compile-fail/borrowck-addr-of-upvar.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
pub fn main() {
22
let foo = ~3;
33
let _pfoo = &foo;
4-
let _f: @fn() -> int = || *foo + 5;
4+
let _f: ~fn() -> int = || *foo + 5;
55
//~^ ERROR cannot move `foo`
66

77
// FIXME(#2202) - Due to the way that borrowck treats closures,
88
// you get two error reports here.
99
let bar = ~3;
1010
let _g = || { //~ ERROR capture of moved value
11-
let _h: @fn() -> int = || *bar; //~ ERROR capture of moved value
11+
let _h: ~fn() -> int = || *bar; //~ ERROR capture of moved value
1212
};
1313
}

branches/try2/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111
struct X {
12-
field: @fn:Send(),
12+
field: ~fn:Send(),
1313
}
1414

15-
fn foo(blk: @fn:()) -> X {
15+
fn foo(blk: ~fn:()) -> X {
1616
return X { field: blk }; //~ ERROR expected bounds `Send` but found no bounds
1717
}
1818

branches/try2/src/test/compile-fail/do2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn f(f: @fn(int) -> bool) -> bool { f(10i) }
11+
fn f(f: &fn(int) -> bool) -> bool { f(10i) }
1212

1313
fn main() {
1414
assert!(do f() |i| { i == 10i } == 10i);

branches/try2/src/test/compile-fail/fn-variance-2.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

branches/try2/src/test/compile-fail/fn-variance-3.rs

Lines changed: 0 additions & 32 deletions
This file was deleted.

branches/try2/src/test/compile-fail/issue-1451.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
// xfail-test
12-
struct T { f: @fn() };
13-
struct S { f: @fn() };
12+
struct T { f: extern "Rust" fn() };
13+
struct S { f: extern "Rust" fn() };
1414

1515
fn fooS(t: S) {
1616
}
@@ -22,11 +22,11 @@ fn bar() {
2222
}
2323

2424
fn main() {
25-
let x: @fn() = bar;
25+
let x: extern "Rust" fn() = bar;
2626
fooS(S {f: x});
2727
fooS(S {f: bar});
2828

29-
let x: @fn() = bar;
29+
let x: extern "Rust" fn() = bar;
3030
fooT(T {f: x});
3131
fooT(T {f: bar});
3232
}

branches/try2/src/test/compile-fail/issue-1896-1.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)