aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-01-06 10:15:46 +0000
committerGitHub <[email protected]>2022-01-06 10:15:46 +0000
commit82e5edb94064b51af433b4c3e89a7cf4b6eaa826 (patch)
treeb7e20e5b1fb1f764d3b837e66858034390cefff5
parent23b9ede3952c2f26c54c77b8df02cd2f8e8f9aad (diff)
parentd5d8897c847052680b25ea1511c4cac39a29a00d (diff)
Merge #567
567: Remove unsafe from new on RND r=Dirbaio a=huntc Unsafe is not required here given that all futures are required to live longer than their global peripheral instances. There are other occurrences of unsafe being used on new that should be removed. I started to do that but then went down a bit of a rabbit hole. Therefore, just confining this PR to what I'm currently exposed to. Co-authored-by: huntc <[email protected]>
-rw-r--r--embassy-nrf/src/rng.rs2
-rw-r--r--examples/nrf/src/bin/rng.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/embassy-nrf/src/rng.rs b/embassy-nrf/src/rng.rs
index 645f9860e..6b36cbb88 100644
--- a/embassy-nrf/src/rng.rs
+++ b/embassy-nrf/src/rng.rs
@@ -52,7 +52,7 @@ impl<'d> Rng<'d> {
52 /// e.g. using `mem::forget`. 52 /// e.g. using `mem::forget`.
53 /// 53 ///
54 /// The synchronous API is safe. 54 /// The synchronous API is safe.
55 pub unsafe fn new( 55 pub fn new(
56 _rng: impl Unborrow<Target = RNG> + 'd, 56 _rng: impl Unborrow<Target = RNG> + 'd,
57 irq: impl Unborrow<Target = interrupt::RNG> + 'd, 57 irq: impl Unborrow<Target = interrupt::RNG> + 'd,
58 ) -> Self { 58 ) -> Self {
diff --git a/examples/nrf/src/bin/rng.rs b/examples/nrf/src/bin/rng.rs
index d12684e35..2f1a26993 100644
--- a/examples/nrf/src/bin/rng.rs
+++ b/examples/nrf/src/bin/rng.rs
@@ -15,7 +15,7 @@ use rand::Rng as _;
15 15
16#[embassy::main] 16#[embassy::main]
17async fn main(_spawner: Spawner, p: Peripherals) { 17async fn main(_spawner: Spawner, p: Peripherals) {
18 let mut rng = unsafe { Rng::new(p.RNG, interrupt::take!(RNG)) }; 18 let mut rng = Rng::new(p.RNG, interrupt::take!(RNG));
19 19
20 // Async API 20 // Async API
21 let mut bytes = [0; 4]; 21 let mut bytes = [0; 4];