aboutsummaryrefslogtreecommitdiff
path: root/src/checked.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-04-07 16:38:39 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-04-07 16:38:39 -0500
commit759ac160db3a02d23b1126c6875143b67f5c2e20 (patch)
tree472c1eb500b751a99b30b7260645cf64b1c03d2d /src/checked.rs
parente631d8513a83d5bf1d1e344977bdd3d84efdbc13 (diff)
remove the borrow_mut method from resources
it can be used to break references rules within nested locks ``` rust static R1: Resource<bool, C1> = unsafe { Resource::new(false) }; static R2: Resource<bool, C2> = unsafe { Resource::new(false) }; static R3: Resource<bool, C3> = unsafe { Resource::new(false) }; // Priority = 1 extern "C" fn j1(task: interrupt::Exti0Irq) { R1.lock(&task, |r1, c1| { R2.lock(&task, |r2, c2| { R3.lock(&task, |r3, mut c3| { // BAD &- and &mut - that point to the same data let r1_ref: &bool = R1.borrow(&c2); let r1_ref_mut: &mut bool = R1.borrow_mut(&mut c3); }); }); }); } ```
Diffstat (limited to 'src/checked.rs')
0 files changed, 0 insertions, 0 deletions