aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-04-14 09:45:50 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-04-14 10:19:08 -0500
commita94de6bafcd95c0313e638138643f87c3b0e6aa0 (patch)
tree3a8858b1eb7936341fc3f1ed9e1cff012f245330 /tests
parent4d8d53a20613efc27042c965765588e4c7fce46d (diff)
wrap references to resources in static-ref's Ref/RefMut
to assert that they point to `static` data
Diffstat (limited to 'tests')
-rw-r--r--tests/cfail/claim_mut.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/cfail/claim_mut.rs b/tests/cfail/claim_mut.rs
index 0d1dffd..50da4a6 100644
--- a/tests/cfail/claim_mut.rs
+++ b/tests/cfail/claim_mut.rs
@@ -8,26 +8,26 @@ static R1: Resource<i32, C2> = Resource::new(0);
fn j1(mut prio: P2) {
// OK only one `&mut-` reference to the data
- let r1: &mut i32 = R1.claim_mut(&mut prio);
+ let r1 = R1.claim_mut(&mut prio);
}
fn j2(prio: P2) {
// OK two `&-` references to the same data
- let r1: &i32 = R1.claim(&prio);
- let another_r1: &i32 = R1.claim(&prio);
+ let r1 = R1.claim(&prio);
+ let another_r1 = R1.claim(&prio);
}
fn j3(mut prio: P2) {
// CAN'T have a `&-` reference and a `&mut-` reference to the same data
- let r1: &i32 = R1.claim(&prio);
- let another_r1: &mut i32 = R1.claim_mut(&mut prio);
+ let r1 = R1.claim(&prio);
+ let another_r1 = R1.claim_mut(&mut prio);
//~^ error
}
fn j4(mut prio: P2) {
// CAN'T have two `&mut-` references to the same data
- let r1: &mut i32 = R1.claim_mut(&mut prio);
- let another_r1: &mut i32 = R1.claim_mut(&mut prio);
+ let r1 = R1.claim_mut(&mut prio);
+ let another_r1 = R1.claim_mut(&mut prio);
//~^ error
}