7
44
Fork
You've already forked nice-plug
22

fix: ungate Vst3Plugin import on macOS and Windows #16

Merged
BillyDM merged 1 commit from Z3U2/nih-plug:fix-macos-windows-vst3-import into main 2026年05月09日 23:10:03 +02:00
Contributor
Copy link

The use crate::wrapper::vst3::Vst3Plugin; statement at crates/nih_plug/src/wrapper/vst3/view.rs:17 is gated to #[cfg(target_os = "linux")], but Vst3Plugin is referenced unconditionally throughout the file:

  • pub(crate) struct WrapperView<P: Vst3Plugin> (line 163)
  • RunLoopEventHandlerWrapper<P: Vst3Plugin> (lines 156, 158) — present under both cfg(target_os = "linux") and cfg(not(target_os = "linux"))
  • impl<P: Vst3Plugin> WrapperView<P> (line 211)
  • impl<P: Vst3Plugin> IPlugView for WrapperView<P> (line 389)
  • impl<P: Vst3Plugin> IPlugViewContentScaleSupport for WrapperView<P> (line 590)
  • a few more Vst3Plugin bounds elsewhere in the file

On macOS and Windows builds with the default vst3 feature enabled, the import isn't brought into scope and the references fail with cannot find Vst3Plugin in this scope.

The #[cfg(target_os = "linux")] attribute appears to have been copy-pasted from the nearby correctly-Linux-only run-loop import block at lines 132+ during 77f828f8 ("split out nih_plug_core"), where the file was reorganised.

The fix is a one-line removal of the cfg attribute. The file's other Linux-specific gates (the run-loop import block at lines 132+, and gates on individual struct fields and impls that use truly Linux-only types) are correct and stay.

Caught while building a downstream consumer on macOS with default features; after this fix cargo build succeeds on macOS and (per the same code path) Windows.

The `use crate::wrapper::vst3::Vst3Plugin;` statement at [`crates/nih_plug/src/wrapper/vst3/view.rs:17`](https://codeberg.org/BillyDM/nih-plug/src/branch/main/crates/nih_plug/src/wrapper/vst3/view.rs#L17) is gated to `#[cfg(target_os = "linux")]`, but `Vst3Plugin` is referenced unconditionally throughout the file: - `pub(crate) struct WrapperView<P: Vst3Plugin>` (line 163) - `RunLoopEventHandlerWrapper<P: Vst3Plugin>` (lines 156, 158) — present under both `cfg(target_os = "linux")` and `cfg(not(target_os = "linux"))` - `impl<P: Vst3Plugin> WrapperView<P>` (line 211) - `impl<P: Vst3Plugin> IPlugView for WrapperView<P>` (line 389) - `impl<P: Vst3Plugin> IPlugViewContentScaleSupport for WrapperView<P>` (line 590) - a few more `Vst3Plugin` bounds elsewhere in the file On macOS and Windows builds with the default `vst3` feature enabled, the import isn't brought into scope and the references fail with `cannot find Vst3Plugin in this scope`. The `#[cfg(target_os = "linux")]` attribute appears to have been copy-pasted from the nearby correctly-Linux-only run-loop import block at lines 132+ during [`77f828f8`](https://codeberg.org/BillyDM/nih-plug/commit/77f828f8) ("split out nih_plug_core"), where the file was reorganised. The fix is a one-line removal of the cfg attribute. The file's other Linux-specific gates (the run-loop import block at lines 132+, and gates on individual struct fields and impls that use truly Linux-only types) are correct and stay. Caught while building a downstream consumer on macOS with default features; after this fix `cargo build` succeeds on macOS and (per the same code path) Windows.
The use statement at view.rs:17 was gated to target_os = "linux",
but Vst3Plugin is referenced unconditionally throughout the file
(WrapperView<P: Vst3Plugin>, IPlugView impls, etc.). Macros expand
those references on every target, so non-Linux builds fail with
"cannot find Vst3Plugin in this scope".
The cfg attribute appears to have been copy-pasted from the nearby
correctly-Linux-only run-loop import block (lines 132+) during the
nih_plug_core split (commit 77f828f8).

Ah, my bad. Thanks for the fix!

Ah, my bad. Thanks for the fix!
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
RustAudio/nice-plug!16
Reference in a new issue
RustAudio/nice-plug
No description provided.
Delete branch "Z3U2/nih-plug:fix-macos-windows-vst3-import"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?