2014-07-22 06:46:36 -05: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.
|
|
|
|
|
|
|
|
// Test which of the builtin types are considered sendable.
|
|
|
|
|
|
|
|
fn assert_send<T:Send>() { }
|
|
|
|
|
|
|
|
// owned content are ok
|
2015-01-08 04:54:35 -06:00
|
|
|
fn test30() { assert_send::<Box<isize>>(); }
|
2014-07-22 06:46:36 -05:00
|
|
|
fn test31() { assert_send::<String>(); }
|
2015-01-08 04:54:35 -06:00
|
|
|
fn test32() { assert_send::<Vec<isize> >(); }
|
2014-07-22 06:46:36 -05:00
|
|
|
|
|
|
|
// but not if they own a bad thing
|
2015-01-08 04:54:35 -06:00
|
|
|
fn test40<'a>(_: &'a isize) {
|
|
|
|
assert_send::<Box<&'a isize>>(); //~ ERROR declared lifetime bound not satisfied
|
2014-07-22 06:46:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|