We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 877e2ac commit 074769cCopy full SHA for 074769c
1 file changed
src/core/mod.rs
@@ -182,7 +182,15 @@ impl Core {
182
let mut core = self.lock();
183
core.input = input as *const [u8];
184
core.input_ports = input_ports as *const [InputPort];
185
- core.audio_callback = Some(std::ptr::addr_of_mut!(audio_callback) as *mut _);
+ // SAFETY: we extend the lifetime of audio_callback to 'static, but it will only be
186
+ // used during the execution of this function. The explicit transmute is needed
187
+ // due to https://github.com/rust-lang/rust/pull/136776
188
+ core.audio_callback = Some(std::mem::transmute::<
189
+ *mut dyn FnMut(&[AudioFrame]),
190
+ *mut (dyn FnMut(&[AudioFrame]) + 'static),
191
+ >(
192
+ std::ptr::addr_of_mut!(audio_callback) as *mut _
193
+ ));
194
std::mem::drop(core);
195
196
run();
0 commit comments