Skip to content

cargo run --example false positive "is a library and cannot be executed" #6159

@Walther

Description

@Walther

RustAudio/vst-rs#71

In rust-vst's Cargo.toml, there is the following definition:

[[example]]
name = "simple_host"
crate-type = ["bin"]

among other example declarations which are crate-type = ["cdylib"] instead.

Trying to run it:

cargo run --example simple_host
error: example target `simple_host` is a library and cannot be executed

However, if you simply remove the line crate-type = ["bin"], it starts working.

<&mbrubeck> Walther: I think the bug is here https://github.com/rust-lang/cargo/blob/master/src/cargo/core/manifest.rs#L654-L658
<&mbrubeck> Any non-empty list is treated as ExampleLib, which triggers https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_run.rs#L40-L45

Metadata

Metadata

Assignees

Labels

A-examplesArea: example targetsA-manifestArea: Cargo.toml issuesC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions