]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/no-send-res-ports.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / test / compile-fail / no-send-res-ports.rs
CommitLineData
223e47cc
LB
1// Copyright 2012 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
85aaf69f 11use std::thread;
1a4d82fc
JJ
12use std::rc::Rc;
13
85aaf69f 14#[derive(Debug)]
1a4d82fc 15struct Port<T>(Rc<T>);
223e47cc
LB
16
17fn main() {
85aaf69f 18 #[derive(Debug)]
223e47cc
LB
19 struct foo {
20 _x: Port<()>,
21 }
22
c1a9b12d 23 impl Drop for foo {
1a4d82fc 24 fn drop(&mut self) {}
223e47cc
LB
25 }
26
27 fn foo(x: Port<()>) -> foo {
28 foo {
29 _x: x
30 }
31 }
32
1a4d82fc 33 let x = foo(Port(Rc::new(())));
223e47cc 34
85aaf69f 35 thread::spawn(move|| {
54a0048b 36 //~^ ERROR `std::rc::Rc<()>: std::marker::Send` is not satisfied
1a4d82fc
JJ
37 let y = x;
38 println!("{:?}", y);
39 });
223e47cc 40}