]> git.proxmox.com Git - cargo.git/commitdiff
Auto merge of #3879 - jbendig:issue_3867, r=alexcrichton
authorbors <bors@rust-lang.org>
Thu, 30 Mar 2017 15:25:03 +0000 (15:25 +0000)
committerbors <bors@rust-lang.org>
Thu, 30 Mar 2017 15:25:03 +0000 (15:25 +0000)
Fix `cargo run` panic when required-features not satisfied

This PR fixes #3867 which is made up of two parts.

The first part involves `cargo run` triggering an assertion after compiling. This is triggered by the single binary selected for compilation being filtered out when required-features is specified and said features are not enabled. The cleanest approach to me involves just sticking a flag into `CompileFilter::Everything`. The flag then triggers the already existing error message when required-features is not satisfied. I think this works best because it localizes what is really a `cargo run` quirk without requiring any boilerplate or duplicate code.

The second part shows `cargo run` bailing when two binaries exist, both with required-features, but only one is resolved to be compiled due to default features. I feel like the current approach is correct because it's consistent with what normally happens when there are multiple binaries. I'm open to changing this, but for now, I've added a test to enforce this behavior.

cc @BenWiederhake: I took a quick peek at your branch to fix #3112 and I noticed that it probably won't merge cleanly with this PR. Just an FYI in case it makes sense to have this merged.


Trivial merge