Skip to content

Commit fc4540d

Browse files
committed
auto merge of #10728 : sanxiyn/rust/proc, r=cmr
Fix #10718.
2 parents 61443dc + e41c331 commit fc4540d

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/librustc/middle/typeck/check/mod.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -2248,8 +2248,19 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
22482248
}
22492249
_ => {
22502250
// Not an error! Means we're inferring the closure type
2251-
(None, ast::impure_fn, ast::BorrowedSigil,
2252-
ast::Many, ty::EmptyBuiltinBounds())
2251+
let mut sigil = ast::BorrowedSigil;
2252+
let mut onceness = ast::Many;
2253+
let mut bounds = ty::EmptyBuiltinBounds();
2254+
match expr.node {
2255+
ast::ExprProc(..) => {
2256+
sigil = ast::OwnedSigil;
2257+
onceness = ast::Once;
2258+
bounds.add(ty::BoundSend);
2259+
}
2260+
_ => ()
2261+
}
2262+
(None, ast::impure_fn, sigil,
2263+
onceness, bounds)
22532264
}
22542265
}
22552266
};

src/test/run-pass/issue-10718.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn f(p: proc()) {
12+
p();
13+
}
14+
15+
pub fn main() {
16+
let p = proc() ();
17+
f(p);
18+
}

0 commit comments

Comments
 (0)