rust/src/test/run-pass/proc-bounds.rs

36 lines
946 B
Rust
Raw Normal View History

// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn foo<T>() {}
fn bar<T>(_: T) {}
fn is_send<T: Send>() {}
fn is_freeze<T: Sync>() {}
fn is_static<T: 'static>() {}
pub fn main() {
foo::<proc()>();
2014-04-07 15:30:48 -05:00
foo::<proc()>();
foo::<proc():Send>();
foo::<proc():Send + Sync>();
foo::<proc():'static + Send + Sync>();
2014-04-07 15:30:48 -05:00
is_send::<proc():Send>();
is_freeze::<proc():Sync>();
2014-04-07 15:30:48 -05:00
is_static::<proc():'static>();
let a = 3i;
bar::<proc()>(proc() {
let b = &a;
println!("{}", *b);
});
}