You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
AFAIU, this should work: cargo run --example simple_host, as the example is a) under subdirectory examples/ and b) explicitly defined under an [[example]] declaration in Cargo.toml. This should make Cargo find the named example and run it (and give us the helpful suggestion "usage: simple_host path/to/vst", and hint the end user towards running the command with a path to a VST as a parameter).
However, what actually happens is this:
cargo run --example simple_host
error: example target `simple_host` is a library and cannot be executed
The behavior for detecting things as libraries or binaries has been implemented in this PR.
Another curiosity: if you remove this part from Cargo.toml:
[[example]]
name = "simple_host"
crate-type = ["bin"]
and run cargo run --example simple_host, you get:
warning: An explicit [[example]] section is specified in Cargo.toml which currently
disables Cargo from automatically inferring other example targets.
This inference behavior will change in the Rust 2018 edition and the following
files will be included as a example target:
* /Users/walther/git/rust-vst/examples/simple_host.rs
This is likely to break cargo build or cargo test as these files may not be
ready to be compiled as a example target today. You can future-proof yourself
and disable this warning by adding `autoexamples = false` to your [package]
section. You may also move the files to a location where Cargo would not
automatically infer them to be a target, such as in subfolders.
For more information on this warning you can consult
https://github.com/rust-lang/cargo/issues/5330
error: no example target named `simple_host`
Additionally, if you remove all of the example declarations from the Cargo.toml, cargo run --example simple_host starts working! However, then the library-vs-binary distinction/detection apparently turns completely off, because now you can run cargo run --example sine_synth and get error[E0601]: `main` function not found in crate `sine_synth from the compiler, not triggering the "is a library" -error.
Could this be a bug in the library / binary detection algorithm in Cargo? Maybe crate-type = ["bin"] is not detected correctly if some of the examples are declared as crate-type = ["cdylib"]? Or maybe the entire project is labelled as a binary because the project itself has no main.rs, only lib.rs, even if some of the examples would have a fn main() and be declared as a bin? If so, I can go and file a bug report in Cargo repo.
EDIT: reported to upstream, see below
The text was updated successfully, but these errors were encountered:
(Moved from here into its own issue)
AFAIU, this should work:
cargo run --example simple_host
, as the example is a) under subdirectoryexamples/
and b) explicitly defined under an[[example]]
declaration inCargo.toml
. This should make Cargo find the named example and run it (and give us the helpful suggestion "usage: simple_host path/to/vst", and hint the end user towards running the command with a path to a VST as a parameter).However, what actually happens is this:
The behavior for detecting things as libraries or binaries has been implemented in this PR.
Another curiosity: if you remove this part from
Cargo.toml
:and run
cargo run --example simple_host
, you get:Additionally, if you remove all of the example declarations from the
Cargo.toml
,cargo run --example simple_host
starts working! However, then the library-vs-binary distinction/detection apparently turns completely off, because now you can runcargo run --example sine_synth
and geterror[E0601]: `main` function not found in crate `sine_synth
from the compiler, not triggering the "is a library" -error.Could this be a bug in the library / binary detection algorithm in Cargo? Maybe
crate-type = ["bin"]
is not detected correctly if some of the examples are declared ascrate-type = ["cdylib"]
? Or maybe the entire project is labelled as a binary because the project itself has nomain.rs
, onlylib.rs
, even if some of the examples would have afn main()
and be declared as abin
? If so, I can go and file a bug report in Cargo repo.EDIT: reported to upstream, see below
The text was updated successfully, but these errors were encountered: