language.
return valid;
}
-pub fn make_test(config: &config, testfile: &Path,
- f: &fn()->test::TestFn) -> test::TestDescAndFn {
+pub fn make_test(config: &config, testfile: &Path, f: || -> test::TestFn)
+ -> test::TestDescAndFn {
test::TestDescAndFn {
desc: test::TestDesc {
name: make_test_name(config, testfile),
!val
}
-fn iter_header(testfile: &Path, it: &fn(&str) -> bool) -> bool {
+fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
use std::io::buffered::BufferedReader;
use std::io::File;
prog, args, procenv, input);
}
-fn make_compile_args(config: &config, props: &TestProps, extras: ~[~str],
- xform: &fn(&config, (&Path)) -> Path,
- testfile: &Path) -> ProcArgs {
+fn make_compile_args(config: &config,
+ props: &TestProps,
+ extras: ~[~str],
+ xform: |&config, &Path| -> Path,
+ testfile: &Path)
+ -> ProcArgs {
let xform_file = xform(config, testfile);
// FIXME (#9639): This needs to handle non-utf8 paths
let mut args = ~[testfile.as_str().unwrap().to_owned(),
}
}
-fn each_ai_flag(_f: &fn(c_int, ai::Flag)) {
+fn each_ai_flag(_f: |c_int, ai::Flag|) {
/* XXX: do we really want to support these?
unsafe {
f(uvll::rust_AI_ADDRCONFIG(), ai::AddrConfig);
}
}
-fn execute(f: &fn(*uvll::uv_fs_t, uvll::uv_fs_cb) -> c_int)
+fn execute(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
-> Result<FsRequest, UvError>
{
let mut req = FsRequest {
}
}
-fn execute_nop(f: &fn(*uvll::uv_fs_t, uvll::uv_fs_cb) -> c_int)
- -> Result<(), UvError>
-{
+fn execute_nop(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
+ -> Result<(), UvError> {
execute(f).map(|_| {})
}
}
}
-fn wait_until_woken_after(slot: *mut Option<BlockedTask>, f: &fn()) {
+fn wait_until_woken_after(slot: *mut Option<BlockedTask>, f: ||) {
let _f = ForbidUnwind::new("wait_until_woken_after");
unsafe {
assert!((*slot).is_none());
/// Generic functions related to dealing with sockaddr things
////////////////////////////////////////////////////////////////////////////////
-fn socket_addr_as_sockaddr<T>(addr: SocketAddr, f: &fn(*sockaddr) -> T) -> T {
+fn socket_addr_as_sockaddr<T>(addr: SocketAddr, f: |*sockaddr| -> T) -> T {
let malloc = match addr.ip {
Ipv4Addr(*) => uvll::rust_malloc_ip4_addr,
Ipv6Addr(*) => uvll::rust_malloc_ip6_addr,
}
/// Converts the program and arguments to the argv array expected by libuv
-fn with_argv<T>(prog: &str, args: &[~str], f: &fn(**libc::c_char) -> T) -> T {
+fn with_argv<T>(prog: &str, args: &[~str], f: |**libc::c_char| -> T) -> T {
// First, allocation space to put all the C-strings (we need to have
// ownership of them somewhere
let mut c_strs = vec::with_capacity(args.len() + 1);
}
/// Converts the environment to the env array expected by libuv
-fn with_env<T>(env: Option<&[(~str, ~str)]>, f: &fn(**libc::c_char) -> T) -> T {
+fn with_env<T>(env: Option<&[(~str, ~str)]>, f: |**libc::c_char| -> T) -> T {
let env = match env {
Some(s) => s,
None => { return f(ptr::null()); }
~AsyncWatcher::new(self.uvio.uv_loop(), f) as ~RemoteCallback
}
- fn io<'a>(&'a mut self, f: &fn(&'a mut IoFactory)) {
+ fn io<'a>(&'a mut self, f: |&'a mut IoFactory|) {
f(&mut self.uvio as &mut IoFactory)
}
}
ObsoleteStructWildcard,
ObsoleteVecDotDotWildcard,
ObsoleteBoxedClosure,
+ ObsoleteClosureType,
}
impl to_bytes::IterBytes for ObsoleteSyntax {
"managed closures have been removed and owned closures are \
now written `proc()`"
),
+ ObsoleteClosureType => (
+ "closure type",
+ "closures are now written `|A| -> B` rather than `&fn(A) -> \
+ B`."
+ ),
};
self.report(sp, kind, kind_str, desc);
return self.parse_ty_closure(Some(sigil), Some(lifetime));
}
- token::IDENT(*) if sigil == ast::BorrowedSigil => {
+ token::IDENT(*) => {
if self.token_is_old_style_closure_keyword() {
self.obsolete(*self.last_span, ObsoleteBoxedClosure);
return self.parse_ty_closure(Some(sigil), None);
let opt_lifetime = self.parse_opt_lifetime();
if self.token_is_old_style_closure_keyword() {
+ self.obsolete(*self.last_span, ObsoleteClosureType);
return self.parse_ty_closure(Some(BorrowedSigil), opt_lifetime);
}
// except according to those terms.
struct X {
- field: &'static fn:Send(),
+ field: 'static ||:Send,
}
-fn foo(blk: &'static fn:()) -> X {
+fn foo(blk: 'static ||:) -> X {
return X { field: blk }; //~ ERROR expected bounds `Send` but found no bounds
}
use extra::arc;
use std::util;
-fn foo(blk: &once fn()) {
+fn foo(blk: once ||) {
blk();
blk(); //~ ERROR use of moved value
}
#[feature(once_fns)];
fn main() {
- let f: &once fn() = ||();
+ let f: once || = ||();
let g: || = f; //~ ERROR mismatched types
let h: || = ||();
- let i: &once fn() = h; // ok
+ let i: once || = h; // ok
}
use extra::arc;
use std::util;
-fn foo(blk: &once fn()) {
+fn foo(blk: once ||) {
blk();
}