From d555e3b6700ae1434ea7dcaf71a98f7dc96e4f32 Mon Sep 17 00:00:00 2001 From: Frostie314159 Date: Mon, 18 Dec 2023 09:31:57 +0100 Subject: [PATCH] Added safety comment. --- src/ctx.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ctx.rs b/src/ctx.rs index 36b739c..e24d2dc 100644 --- a/src/ctx.rs +++ b/src/ctx.rs @@ -804,6 +804,8 @@ impl<'a, Ctx: Copy, T: TryFromCtx<'a, Ctx, Error = error::Error>, const N: usize } if let Some((e, idx)) = error_ctx { for element in &mut buf[0..idx].iter_mut() { + // SAFETY: Any element upto idx must have already been initialized, since + // we iterate until we encounter an error. unsafe { element.assume_init_drop(); }