summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/issue-7013.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/issue-7013.rs')
-rw-r--r--tests/ui/traits/issue-7013.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/traits/issue-7013.rs b/tests/ui/traits/issue-7013.rs
new file mode 100644
index 000000000..1fb01303c
--- /dev/null
+++ b/tests/ui/traits/issue-7013.rs
@@ -0,0 +1,26 @@
+use std::cell::RefCell;
+use std::rc::Rc;
+
+trait Foo {
+ fn set(&mut self, v: Rc<RefCell<A>>);
+}
+
+struct B {
+ v: Option<Rc<RefCell<A>>>
+}
+
+impl Foo for B {
+ fn set(&mut self, v: Rc<RefCell<A>>)
+ {
+ self.v = Some(v);
+ }
+}
+
+struct A {
+ v: Box<dyn Foo + Send>,
+}
+
+fn main() {
+ let a = A {v: Box::new(B{v: None}) as Box<dyn Foo + Send>};
+ //~^ ERROR `Rc<RefCell<A>>` cannot be sent between threads safely
+}