2014-03-08 20:21:01 -06:00
|
|
|
// 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>() {}
|
2014-08-05 18:40:04 -05:00
|
|
|
fn is_freeze<T: Sync>() {}
|
2014-03-08 20:21:01 -06:00
|
|
|
fn is_static<T: 'static>() {}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
foo::<proc()>();
|
2014-04-07 15:30:48 -05:00
|
|
|
foo::<proc()>();
|
|
|
|
foo::<proc():Send>();
|
2014-08-05 18:40:04 -05:00
|
|
|
foo::<proc():Send + Sync>();
|
|
|
|
foo::<proc():'static + Send + Sync>();
|
2014-03-08 20:21:01 -06:00
|
|
|
|
2014-04-07 15:30:48 -05:00
|
|
|
is_send::<proc():Send>();
|
2014-08-05 18:40:04 -05:00
|
|
|
is_freeze::<proc():Sync>();
|
2014-04-07 15:30:48 -05:00
|
|
|
is_static::<proc():'static>();
|
2014-03-08 20:21:01 -06:00
|
|
|
|
|
|
|
|
2014-04-21 16:58:52 -05:00
|
|
|
let a = 3i;
|
2014-06-20 12:49:54 -05:00
|
|
|
bar::<proc()>(proc() {
|
2014-03-08 20:21:01 -06:00
|
|
|
let b = &a;
|
|
|
|
println!("{}", *b);
|
|
|
|
});
|
|
|
|
}
|