Skip to content

Commit fed48cc

Browse files
committed
auto merge of #10132 : pcwalton/rust/proc, r=pcwalton
the feature gate for `once fn` if used with the `~` sigil. r? @brson
2 parents 52f42f1 + 7e77bf1 commit fed48cc

File tree

29 files changed

+252
-72
lines changed

29 files changed

+252
-72
lines changed

src/compiletest/procsrv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn run(lib_path: &str,
4848
input: Option<~str>) -> Result {
4949

5050
let env = env + target_env(lib_path, prog);
51-
let mut proc = run::Process::new(prog, args, run::ProcessOptions {
51+
let mut process = run::Process::new(prog, args, run::ProcessOptions {
5252
env: Some(env),
5353
dir: None,
5454
in_fd: None,
@@ -57,9 +57,9 @@ pub fn run(lib_path: &str,
5757
});
5858

5959
for input in input.iter() {
60-
proc.input().write(input.as_bytes());
60+
process.input().write(input.as_bytes());
6161
}
62-
let output = proc.finish_with_output();
62+
let output = process.finish_with_output();
6363

6464
Result {
6565
status: output.status,

src/librustc/front/feature_gate.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ impl Visitor<()> for Context {
132132

133133
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {
134134
match t.node {
135-
ast::ty_closure(closure) if closure.onceness == ast::Once => {
135+
ast::ty_closure(closure) if closure.onceness == ast::Once &&
136+
closure.sigil != ast::OwnedSigil => {
136137
self.gate_feature("once_fns", t.span,
137138
"once functions are \
138139
experimental and likely to be removed");

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl<'self> CheckLoanCtxt<'self> {
656656

657657
fn check_move_out_from_expr(&self, expr: @ast::Expr) {
658658
match expr.node {
659-
ast::ExprFnBlock(*) => {
659+
ast::ExprFnBlock(*) | ast::ExprProc(*) => {
660660
// moves due to capture clauses are checked
661661
// in `check_loans_in_fn`, so that we can
662662
// give a better error message

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt,
307307
this.pop_repeating_id(body.id);
308308
}
309309

310-
ast::ExprFnBlock(*) => {
310+
ast::ExprFnBlock(*) | ast::ExprProc(*) => {
311311
gather_moves::gather_captures(this.bccx, this.move_data, ex);
312312
visit::walk_expr(this, ex, ());
313313
}

src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ impl CFGBuilder {
409409
ast::ExprInlineAsm(*) |
410410
ast::ExprSelf |
411411
ast::ExprFnBlock(*) |
412+
ast::ExprProc(*) |
412413
ast::ExprLit(*) |
413414
ast::ExprPath(*) => {
414415
self.straightline(expr, pred, [])

src/librustc/middle/check_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Visitor<Context> for CheckLoopVisitor {
4949
ExprLoop(ref b, _) => {
5050
self.visit_block(b, Context { in_loop: true,.. cx });
5151
}
52-
ExprFnBlock(_, ref b) => {
52+
ExprFnBlock(_, ref b) | ExprProc(_, ref b) => {
5353
self.visit_block(b, Context { in_loop: false, can_ret: false });
5454
}
5555
ExprBreak(_) => {

src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
431431
self.merge_with_entry_set(expr.id, in_out);
432432

433433
match expr.node {
434-
ast::ExprFnBlock(ref decl, ref body) => {
434+
ast::ExprFnBlock(ref decl, ref body) |
435+
ast::ExprProc(ref decl, ref body) => {
435436
if self.dfcx.oper.walk_closures() {
436437
// In the absence of once fns, we must assume that
437438
// every function body will execute more than

src/librustc/middle/freevars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Visitor<int> for CollectFreevarsVisitor {
4747
fn visit_expr(&mut self, expr:@ast::Expr, depth:int) {
4848

4949
match expr.node {
50-
ast::ExprFnBlock(*) => {
50+
ast::ExprFnBlock(*) | ast::ExprProc(*) => {
5151
visit::walk_expr(self, expr, depth + 1)
5252
}
5353
ast::ExprPath(*) | ast::ExprSelf => {

src/librustc/middle/liveness.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: @Expr, this: @mut IrMaps) {
485485
}
486486
visit::walk_expr(v, expr, this);
487487
}
488-
ExprFnBlock(*) => {
488+
ExprFnBlock(*) | ExprProc(*) => {
489489
// Interesting control flow (for loops can contain labeled
490490
// breaks or continues)
491491
this.add_live_node_for_node(expr.id, ExprNode(expr.span));
@@ -1023,8 +1023,8 @@ impl Liveness {
10231023
self.propagate_through_expr(e, succ)
10241024
}
10251025

1026-
ExprFnBlock(_, ref blk) => {
1027-
debug!("{} is an expr_fn_block",
1026+
ExprFnBlock(_, ref blk) | ExprProc(_, ref blk) => {
1027+
debug!("{} is an ExprFnBlock or ExprProc",
10281028
expr_to_str(expr, self.tcx.sess.intr()));
10291029

10301030
/*
@@ -1498,7 +1498,8 @@ fn check_expr(this: &mut Liveness, expr: @Expr) {
14981498
ExprCast(*) | ExprUnary(*) | ExprRet(*) | ExprBreak(*) |
14991499
ExprAgain(*) | ExprLit(_) | ExprBlock(*) |
15001500
ExprMac(*) | ExprAddrOf(*) | ExprStruct(*) | ExprRepeat(*) |
1501-
ExprParen(*) | ExprFnBlock(*) | ExprPath(*) | ExprSelf(*) => {
1501+
ExprParen(*) | ExprFnBlock(*) | ExprProc(*) | ExprPath(*) |
1502+
ExprSelf(*) => {
15021503
visit::walk_expr(this, expr, ());
15031504
}
15041505
ExprForLoop(*) => fail!("non-desugared expr_for_loop")

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl mem_categorization_ctxt {
424424

425425
ast::ExprAddrOf(*) | ast::ExprCall(*) |
426426
ast::ExprAssign(*) | ast::ExprAssignOp(*) |
427-
ast::ExprFnBlock(*) | ast::ExprRet(*) |
427+
ast::ExprFnBlock(*) | ast::ExprProc(*) | ast::ExprRet(*) |
428428
ast::ExprDoBody(*) | ast::ExprUnary(*) |
429429
ast::ExprMethodCall(*) | ast::ExprCast(*) | ast::ExprVstore(*) |
430430
ast::ExprVec(*) | ast::ExprTup(*) | ast::ExprIf(*) |

0 commit comments

Comments
 (0)