diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2017-12-09 14:43:29 +0100 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2017-12-09 17:17:56 +0100 |
| commit | a6dd004113fcbc03ffacacc519d742ee84886c1d (patch) | |
| tree | 66b70421a0ab00ab8a2be2fb990c15223e495535 /tests/cfail | |
| parent | 219e17268018f397ff3c8a41519c8345aeab7f2f (diff) | |
implement the Resource trait for owned resources
this unbreaks the "generics" example
Diffstat (limited to 'tests/cfail')
| -rw-r--r-- | tests/cfail/lock.rs | 20 | ||||
| -rw-r--r-- | tests/cfail/token-transfer.rs | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/cfail/lock.rs b/tests/cfail/lock.rs index 5630649..eb03b7d 100644 --- a/tests/cfail/lock.rs +++ b/tests/cfail/lock.rs @@ -45,22 +45,24 @@ fn idle() -> ! { } fn exti0(mut t: &mut Threshold, mut r: EXTI0::Resources) { + // ERROR need to lock to access the resource because priority < ceiling + if *r.ON { + //~^ error type `EXTI0::ON` cannot be dereferenced + } + // OK need to lock to access the resource - if r.ON.claim(&mut t, |on, _| **on) {} + if r.ON.claim(&mut t, |on, _| *on) {} // OK can claim a resource with maximum ceiling - r.MAX.claim_mut(&mut t, |max, _| **max += 1); + r.MAX.claim_mut(&mut t, |max, _| *max += 1); } fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) { - // ERROR no need to lock. Has direct access because priority == ceiling - if (**r.ON).claim(&mut t, |on, _| **on) { - //~^ error no method named `claim` found for type - } + // OK to directly access the resource because priority == ceiling + if *r.ON {} - if **r.ON { - // OK - } + // though the resource can still be claimed -- the claim is a no-op + if r.ON.claim(&mut t, |on, _| *on) {} } fn exti2(_t: &mut Threshold, _r: EXTI2::Resources) {} diff --git a/tests/cfail/token-transfer.rs b/tests/cfail/token-transfer.rs index bc62052..f92e4b2 100644 --- a/tests/cfail/token-transfer.rs +++ b/tests/cfail/token-transfer.rs @@ -9,7 +9,7 @@ extern crate stm32f103xx; use rtfm::{app, Threshold}; -app! { //~ error bound `rtfm::Threshold: core::marker::Send` is not satisfied +app! { //~ error bound `*const (): core::marker::Send` is not satisfied device: stm32f103xx, resources: { |
